-
-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (59 loc) · 1.69 KB
/
deploy-to-prod.yml
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
name: Deploy to Production (main)
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: deploy-to-prod
cancel-in-progress: true
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment: deploy-to-prod
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT_CHECKOUT }}
submodules: "recursive"
- uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "yarn"
- uses: actions/cache/restore@v4
with:
path: |
public
.cache
key: gatsby-v1-${{ hashFiles('public') }}
restore-keys: |
gatsby-v1-
- run: yarn install --immutable
- run: yarn build
env:
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_REGION: ${{ secrets.AWS_REGION }}
GTM_ID: ${{ vars.GTM_ID }}
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
role-duration-seconds: 7200
mask-aws-account-id: true
- run: yarn deploy
env:
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_REGION: ${{ secrets.AWS_REGION }}
- run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"
- uses: actions/cache/save@v4
with:
path: |
public
.cache
key: gatsby-v1-${{ hashFiles('public') }}