-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (85 loc) · 2.93 KB
/
Copy pathcd.yaml
File metadata and controls
89 lines (85 loc) · 2.93 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
84
85
86
87
88
89
name: Continuous Delivery
on:
push:
jobs:
infra:
runs-on: ubuntu-latest
name: deploy infrastructure
permissions:
contents: read
id-token: write
outputs:
StaticSiteBucketName: ${{ steps.deploy.outputs.StaticSiteBucketName }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::865116139480:role/github-actions-limulus-dot-net-cf
aws-region: us-west-2
- id: deploy
run: |
npx cdk deploy --require-approval never --outputs-file cdk-outputs.json
echo "StaticSiteBucketName=$(cat cdk-outputs.json | jq -r '.["limulus-dot-net-${{ github.ref_name }}"].StaticSiteBucketName')" >> $GITHUB_OUTPUT
env:
LIMULUS_DOT_NET_ZONE_ID: ${{ secrets.LIMULUS_DOT_NET_ZONE_ID }}
LIMULUS_DOT_NET_CERTIFICATE_ARN: ${{ secrets.LIMULUS_DOT_NET_CERTIFICATE_ARN }}
BRANCH_NAME: ${{ github.ref_name }}
build:
runs-on: ubuntu-latest
name: build website
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm run update-revisions
- name: Commit updated revision history
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add www/_data/revisions.json
git diff --cached --quiet || \
git commit -m "chore: update revision history [skip ci]" && git push --no-verify
- run: npm run build
env:
MAPBOX_PUBLIC_TOKEN: ${{ secrets.MAPBOX_PUBLIC_TOKEN }}
- uses: actions/upload-artifact@v5
with:
name: dist-www
path: dist/www
retention-days: 15
deploy:
needs:
- infra
- build
name: deploy website
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v6
with:
name: dist-www
path: www
- uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::865116139480:role/github-actions-limulus-dot-net-s3
aws-region: us-west-2
- run: aws s3 sync www s3://${{ needs.infra.outputs.StaticSiteBucketName }} --cache-control max-age=60,public --exclude '*.xsd'
- run: aws s3 sync www s3://${{ needs.infra.outputs.StaticSiteBucketName }} --content-type application/xml --include '*.xsd'