-
Notifications
You must be signed in to change notification settings - Fork 0
/
.projenrc.ts
86 lines (81 loc) · 2.4 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
import { cdk, JsonPatch } from "projen";
import { NpmAccess } from "projen/lib/javascript";
import { MergeQueue } from "./src";
const project = new cdk.JsiiProject({
author: "AWS",
authorAddress: "[email protected]",
defaultReleaseBranch: "main",
name: "@projen/canary-package",
projenrcTs: true,
release: true,
repositoryUrl: "https://github.com/projen/canary-testing.git",
prettier: true,
jsiiVersion: "5.4.x",
typescriptVersion: "5.4.x",
jestOptions: {
jestVersion: "^29",
},
autoApproveUpgrades: true,
autoApproveOptions: {
allowedUsernames: ["cdklabs-automation", "dependabot[bot]"],
},
githubOptions: {
mergify: false,
pullRequestBackport: true,
pullRequestBackportOptions: {
branches: ["v1"],
},
},
peerDeps: ["constructs@^10.0.0", "[email protected] >=0.75.0"],
peerDependencyOptions: {
pinnedDevDependency: false,
},
npmAccess: NpmAccess.PUBLIC,
publishToMaven: {
javaPackage: "io.github.cdklabs.projen_canary_package",
mavenGroupId: "io.github.cdklabs",
mavenArtifactId: "projen_canary_package",
mavenEndpoint: "https://s01.oss.sonatype.org",
},
});
const label = "backport-to-";
const cond =
"github.event.pull_request.merged && !(contains(github.event.pull_request.labels.*.name, 'backport'))";
project.github?.tryFindWorkflow("backport")?.file?.patch(
JsonPatch.add("/jobs/backport/if", cond),
JsonPatch.add("/jobs/backport/steps/0", {
id: "check_labels",
name: "Check for backport labels",
run: [
"labels='${{ toJSON(github.event.pull_request.labels.*.name) }}'",
`matched=$(echo $labels | jq '.|map(select(startswith("${label}"))) | length')`,
'echo "matched=$matched"',
'echo "matched=$matched" >> $GITHUB_OUTPUT',
].join("\n"),
}),
JsonPatch.add(
"/jobs/backport/steps/1/if",
"fromJSON(steps.check_labels.outputs.matched) > 0",
),
);
new MergeQueue(project, {
mergeBranch: "main",
autoMergeOptions: {
labels: ["auto-approve"],
},
});
// fix java version
const javaVersion = "11";
project.github?.tryFindWorkflow("build")?.file?.patch(
JsonPatch.replace("/jobs/package-java/steps/0/with", {
distribution: "corretto",
"java-version": javaVersion,
}),
);
project.github?.tryFindWorkflow("release")?.file?.patch(
JsonPatch.replace("/jobs/release_maven/steps/0/with", {
distribution: "corretto",
"java-version": javaVersion,
}),
);
project.synth();