-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmain.ts
More file actions
57 lines (51 loc) · 1.36 KB
/
main.ts
File metadata and controls
57 lines (51 loc) · 1.36 KB
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
import { Construct } from 'constructs'
import { App, Stack, Workflow } from 'cdkactions'
import { DeployJob, NukeJob, ReactProject } from '@pennlabs/kraken'
export class WebsiteStack extends Stack {
constructor(scope: Construct, name: string) {
super(scope, name)
const workflow = new Workflow(this, 'build-and-deploy', {
name: 'Build and Deploy',
on: 'push',
})
const websiteJob = new ReactProject(workflow, {
imageName: 'website',
publishProps: {
push: "${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/feat/') == true }}"
}
})
// Add Production Deploy
new DeployJob(
workflow,
{
},
{
needs: [websiteJob.publishJobId],
},
)
// Add Feature Branch Deploy to Original Workflow
new DeployJob(
workflow,
{
deployToFeatureBranch: true,
deploymentUrls: ["pennlabs.org"]
},
{
needs: [websiteJob.publishJobId],
},
)
// Create Feature Branch Nuke Worflow
const featureBranchNukeWorkflow = new Workflow(
this,
'feature-branch-nuke',
{
name: 'Feature Branch Nuke',
on: { pullRequest: { types: ['closed'] } },
},
)
new NukeJob(featureBranchNukeWorkflow, {}, {})
}
}
const app = new App()
new WebsiteStack(app, 'website')
app.synth()