-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.projenrc.js
126 lines (115 loc) · 3.72 KB
/
.projenrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
const { awscdk } = require('projen');
const project = new awscdk.AwsCdkTypeScriptApp({
cdkVersion: '2.1.0',
defaultReleaseBranch: 'main',
name: 'Serverlytics',
license: 'Apache-2.0',
deps: [
'cdk-custom-domain-lib',
'cdk-api-gateway-helper-lib',
'aws-lambda',
'aws-sdk',
'dotenv',
], /* Runtime dependencies of this module. */
devDeps: [
'@types/aws-lambda',
'cdk-dia',
], /* Build dependencies for this module. */
gitignore: [
'.env',
'diagram.dot',
], /* Exclude from git. */
buildWorkflow: false,
releaseWorkflow: false,
});
// add .env and diagram.dot to package ignore
project.addPackageIgnore('.env');
project.addPackageIgnore('diagram.dot');
// add a new task to create a new stack diagram
const addDia = project.addTask('dia', {
description: 'create a new diagram',
exec: 'npx cdk-dia',
});
project.projectBuild.postCompileTask.spawn(addDia);
// add a new task to deploy all stacks
project.addTask('deploy-all', {
exec: 'cdk deploy --all',
});
// Create our own build workflow
const prWorkflow = project.github.addWorkflow('build');
prWorkflow.on({
push: {
pull_request: {},
workflow_dispatch: {},
},
});
prWorkflow.addJobs({
build: {
runsOn: 'ubuntu-latest',
permissions: { contents: 'write', contents: 'write' },
steps: [
{
name: 'Install graphviz',
uses: 'ts-graphviz/setup-graphviz@v1',
},
{
name: 'Checkout',
uses: 'actions/checkout@v2',
with: {
ref: '${{ github.event.pull_request.head.ref }}',
repository: '${{ github.event.pull_request.head.repo.full_name }}',
},
},
{
name: 'Install dependencies',
run: 'yarn install --check-files --frozen-lockfile',
},
{
name: 'Anti-tamper check',
run: 'git diff --ignore-space-at-eol --exit-code',
},
{
name: 'Set git identity',
run: 'git config user.name "Automation"\ngit config user.email "[email protected]"',
},
{
name: 'build',
run: 'npm run build',
},
// {
// name: 'Check for changes',
// id: 'git_diff',
// run: 'git diff --exit-code || echo "::set-output name=has_changes::true"',
// },
// {
// if: 'steps.git_diff.outputs.has_changes',
// name: 'Commit and push changes (if changed)',
// run: 'git add . && git commit -m "chore: self mutation" && git push origin HEAD:${{ github.event.pull_request.head.ref }}',
// },
// {
// if: 'steps.git_diff.outputs.has_changes',
// name: 'Update status check (if changed)',
// run: 'gh api -X POST /repos/${{ github.event.pull_request.head.repo.full_name}}/check-runs -F name="build" -F head_sha="$(git rev-parse HEAD)" -F status="completed" -F conclusion="success"',
// env: { GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' },
// },
],
env: {
CI: 'true',
DOMAIN: '${{ secrets.DOMAIN }}',
APP_NAME: '${{ secrets.APP_NAME }}',
APP_NAME_SHORT: '${{ secrets.APP_NAME_SHORT }}',
UM_API_KEY: '${{ secrets.UM_API_KEY }}',
TOKEN_API_KEY: '${{ secrets.TOKEN_API_KEY }}',
BASIC_APP_KEY: '${{ secrets.BASIC_APP_KEY }}',
COGNITO_FROM_EMAIL: '${{ secrets.COGNITO_FROM_EMAIL }}',
COGNITO_FROM_NAME: '${{ secrets.COGNITO_FROM_NAME }}',
COGNITO_EMAIL_REPLY_TO: '${{ secrets.COGNITO_EMAIL_REPLY_TO }}',
DELETE_USERS_ON_STACK_DESTROY: '${{ secrets.DELETE_USERS_ON_STACK_DESTROY }}',
AWS_ACCESS_KEY_ID: '${{ secrets.AWS_ACCESS_KEY_ID }}',
AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}',
AWS_REGION: '${{ secrets.AWS_REGION }}',
},
},
});
//synthesize the project
project.synth();