-
Notifications
You must be signed in to change notification settings - Fork 19
/
.projenrc.ts
106 lines (100 loc) · 2.99 KB
/
.projenrc.ts
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
const { awscdk } = require('projen');
const { JobPermission } = require('projen/lib/github/workflows-model');
const { UpgradeDependenciesSchedule } = require('projen/lib/javascript');
const AUTOMATION_TOKEN = 'PROJEN_GITHUB_TOKEN';
const project = new awscdk.AwsCdkTypeScriptApp({
cdkVersion: '2.101.0',
defaultReleaseBranch: 'main',
name: 'amazon-chime-sdk-meeting-with-with-transcribe',
appEntrypoint: 'amazon-chime-sdk-meeting-with-transcribe.ts',
devDeps: ['esbuild'],
jest: false,
projenrcTs: true,
deps: [
'fs-extra',
'@types/fs-extra',
'@aws-sdk/client-chime-sdk-meetings',
'@aws-sdk/client-chime-sdk-media-pipelines',
'@aws-sdk/lib-dynamodb',
'@aws-sdk/client-dynamodb',
'@types/aws-lambda',
'aws-lambda',
],
autoApproveOptions: {
secret: 'GITHUB_TOKEN',
allowedUsernames: ['schuettc'],
},
depsUpgradeOptions: {
ignoreProjen: false,
workflowOptions: {
labels: ['auto-approve', 'auto-merge'],
schedule: UpgradeDependenciesSchedule.WEEKLY,
},
},
scripts: {
launch:
'yarn && yarn projen && yarn build && yarn cdk bootstrap && yarn cdk deploy && yarn configLocal',
},
});
const upgradeSite = project.github.addWorkflow('upgrade-site');
upgradeSite.on({ schedule: [{ cron: '0 5 * * 1' }], workflowDispatch: {} });
upgradeSite.addJobs({
upgradeSite: {
runsOn: ['ubuntu-latest'],
name: 'upgrade-site',
permissions: {
actions: JobPermission.WRITE,
contents: JobPermission.READ,
idToken: JobPermission.WRITE,
},
steps: [
{ uses: 'actions/checkout@v3' },
{
name: 'Setup Node.js',
uses: 'actions/setup-node@v3',
with: {
'node-version': '18',
},
},
{
run: 'yarn install --check-files --frozen-lockfile',
workingDirectory: 'site',
},
{
run: 'yarn upgrade',
workingDirectory: 'site',
},
{
name: 'Create Pull Request',
uses: 'peter-evans/create-pull-request@v4',
with: {
'token': '${{ secrets.' + AUTOMATION_TOKEN + ' }}',
'commit-message': 'chore: upgrade site',
'branch': 'auto/projen-upgrade',
'title': 'chore: upgrade site',
'body': 'This PR upgrades site',
'labels': 'auto-merge, auto-approve',
'author': 'github-actions <[email protected]>',
'committer': 'github-actions <[email protected]>',
'signoff': true,
},
},
],
},
});
const common_exclude = [
'cdk.out',
'cdk.context.json',
'yarn-error.log',
'dependabot.yml',
'*.drawio',
'.DS_Store',
];
project.addTask('getBucket', {
exec: "aws cloudformation describe-stacks --stack-name AmazonChimeSDKWithTranscribe --query 'Stacks[0].Outputs[?OutputKey==`siteBucket`].OutputValue' --output text",
});
project.addTask('configLocal', {
exec: 'aws s3 cp s3://$(yarn run --silent getBucket)/config.json site/public/',
});
project.gitignore.exclude(...common_exclude);
project.synth();