-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (70 loc) · 2.31 KB
/
Copy pathdeploy.yml
File metadata and controls
83 lines (70 loc) · 2.31 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
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
name: Deploy Resources on AWS
on:
push:
branches: [main]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
pull-requests: write
issues: read
concurrency:
group: production
cancel-in-progress: false
jobs:
publish:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::184077986974:role/computable-coffee-cdktf-cloudfront-deploy
aws-region: us-east-1
- name: Setup Emscripten toolchain
uses: mymindstorm/setup-emsdk@v14
with:
version: latest
cache: "emsdk"
actions-cache-folder: 'emsdk-cache'
- name: Build for Web
run: |
emcmake cmake -B build-web
cmake --build build-web
mkdir dist
cp build-web/basic_mesh.js dist/
cp build-web/basic_mesh.data dist/
cp build-web/basic_mesh.wasm dist/
cp build-web/basic_mesh.html dist/index.html
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
- name: Install dependencies
working-directory: ${{ github.workspace }}/iac
run: npm ci
- name: Run Tests IaC
working-directory: ${{ github.workspace }}/iac
run: npm test
- name: Run Terraform CDK
uses: hashicorp/terraform-cdk-action@v0.2
with:
terraformVersion: 1.6.4
cdktfVersion: 0.19.1
stackName: computable-coffee
mode: auto-approve-apply
workingDirectory: ${{ github.workspace }}/iac
githubToken: ${{ secrets.GITHUB_TOKEN }}
commentOnPr: false
- name: Get CloudFront Distribution ID
working-directory: ${{ github.workspace }}/iac/cdktf.out/stacks/computable-coffee
run: |
echo "DISTRIBUTION=$(terraform output -raw distribution_id)" >> $GITHUB_ENV
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ env.DISTRIBUTION }}
PATHS: "/*"
AWS_REGION: "us-east-1"