-
Notifications
You must be signed in to change notification settings - Fork 20
45 lines (37 loc) · 1.18 KB
/
dev-deploy.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
name: Deploy to S3 and CloudFront
on:
push:
branches: [main]
permissions:
id-token: write
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20.10.0"
- name: Install Dependencies
run: npm ci
- name: Build Next.js Site
env:
NEXT_PUBLIC_BASE_PATH: ""
run: npm run build-dev:anvil-portal
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.DEV_AWS_ACCOUNT_ID }}:role/${{ secrets.DEV_AWS_ROLE_NAME }}
role-session-name: ${{ secrets.DEV_ROLE_SESSION_NAME }}
aws-region: ${{ secrets.DEV_AWS_REGION }}
- name: Sync to S3
env:
SRCDIR: out/
run: |
aws s3 sync $SRCDIR s3://${{ secrets.DEV_S3_BUCKET_NAME }} --delete
- name: Invalidate CloudFront Cache
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.DEV_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"