forked from CloudSnorkel/cdk-github-runners
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.projenrc.js
141 lines (134 loc) · 4.2 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
const fs = require('fs');
const { awscdk } = require('projen');
const { Stability } = require('projen/lib/cdk/jsii-project');
const project = new awscdk.AwsCdkConstructLibrary({
author: 'Amir Szekely',
authorAddress: 'amir@cloudsnorkel.com',
stability: Stability.EXPERIMENTAL,
cdkVersion: '2.50.0', // 2.21.1 for lambda url, 2.29.0 for Names.uniqueResourceName(), 2.50.0 for JsonPath.base64Encode
defaultReleaseBranch: 'main',
name: '@cloudsnorkel/cdk-github-runners',
repositoryUrl: 'https://github.com/CloudSnorkel/cdk-github-runners.git',
license: 'Apache-2.0',
description: 'CDK construct to create GitHub Actions self-hosted runners. A webhook listens to events and creates ephemeral runners on the fly.',
// packageName: undefined, /* The "name" in package.json. */
devDeps: [
'esbuild', // for faster NodejsFunction bundling
'@octokit/core',
'@octokit/auth-app',
'@octokit/request-error',
'@octokit/rest',
'aws-sdk',
'@aws-sdk/types',
'@aws-sdk/client-lambda',
'@types/aws-lambda',
'semver',
'@types/semver',
// for setup ui
'@sveltejs/vite-plugin-svelte@^1.0.1',
'@tsconfig/svelte@^3.0.0',
'bootstrap@^5.2.0',
'sass@^1.54.0',
'svelte@^3.49.0',
'svelte-check@^2.8.0',
'svelte-preprocess@^4.10.7',
//'tslib@^2.4.0',
//'typescript@^4.6.4',
'vite@^3.0.0',
'vite-plugin-singlefile@^0.11.0',
],
deps: [
],
excludeTypescript: [
// we build lambdas manually below
'src/lambdas',
],
releaseToNpm: true,
publishToPypi: {
distName: 'cloudsnorkel.cdk-github-runners',
module: 'cloudsnorkel.cdk_github_runners',
},
publishToGo: {
moduleName: 'github.com/CloudSnorkel/cdk-github-runners-go',
},
publishToMaven: {
mavenGroupId: 'com.cloudsnorkel',
mavenArtifactId: 'cdk.github.runners',
javaPackage: 'com.cloudsnorkel.cdk.github.runners',
mavenEndpoint: 'https://s01.oss.sonatype.org',
},
publishToNuget: {
dotNetNamespace: 'CloudSnorkel',
packageId: 'CloudSnorkel.Cdk.Github.Runners',
},
keywords: [
'aws',
'aws-cdk',
'aws-cdk-construct',
'cdk',
'codebuild',
'lambda',
'fargate',
'github',
'github-actions',
'self-hosted',
],
gitignore: [
'cdk.out',
'cdk.context.json',
'/.idea',
'status.json',
],
sampleCode: false,
compat: true,
autoApproveOptions: {
allowedUsernames: ['kichik', 'CloudSnorkelBot'],
},
depsUpgradeOptions: {
workflowOptions: {
labels: ['auto-approve'],
schedule: {
cron: ['0 0 * * 1'],
},
},
},
githubOptions: {
pullRequestLintOptions: {
semanticTitleOptions: {
types: [
'feat',
'fix',
'chore',
'docs',
],
},
},
},
pullRequestTemplate: false,
});
// disable automatic releases, but keep workflow that can be triggered manually
const releaseWorkflow = project.github.tryFindWorkflow('release');
releaseWorkflow.file.addDeletionOverride('on.push');
// bundle lambdas so user doesn't have to install dependencies like octokit locally
const lambdas = fs.readdirSync('src/lambdas');
for (const lambdaDir of lambdas) {
if (fs.lstatSync(`src/lambdas/${lambdaDir}`).isDirectory()) {
// we use tsconfig.dev.json because it has esModuleInterop=true and octokit fails without it
project.compileTask.exec(`esbuild src/lambdas/${lambdaDir}/index.ts --bundle --platform=node --target=node14 --external:aws-sdk --outfile=lib/lambdas/${lambdaDir}/index.js`);
}
}
// bundle docker images
project.compileTask.exec('cp -r src/providers/docker-images lib/providers');
// set proper line endings
project.gitattributes.addAttributes('*.js', 'eol=lf');
project.gitattributes.addAttributes('*.json', 'eol=lf');
project.gitattributes.addAttributes('*.sh', 'eol=lf');
project.gitattributes.addAttributes('*.yml', 'eol=lf');
project.gitattributes.addAttributes('*.html', 'eol=lf');
project.gitattributes.addAttributes('*.svelte', 'eol=lf');
project.gitattributes.addAttributes('Dockerfile', 'eol=lf');
// setup ui
project.gitignore.addPatterns('/setup/dist');
project.compileTask.exec('vite build setup');
project.compileTask.exec('cp -r setup/dist/index.html lib/lambdas/setup/index.html');
project.synth();