-
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (35 loc) · 1.01 KB
/
deploy.yaml
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
name: Deploy
on:
push:
branches:
- 'main'
concurrency:
group: terraform-production
cancel-in-progress: true
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Build website
run: npm run build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_REPO_ROLE }}
- name: Deploy to S3
run: aws s3 sync build/ s3://${{ secrets.AWS_BUCKET_SITE }} --delete --cache-control "public"
- name: Invalidate CloudFront cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_SITE }} --paths "/*"