-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (32 loc) · 959 Bytes
/
build.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
name: Build
on:
push:
branches:
- main
permissions:
id-token: write
contents: read # This is required for actions/checkout
jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{secrets.AWS_ACCOUNT_ID}}:role/${{secrets.AWS_ROLE_NAME}}
role-session-name: github-actions
aws-region: ap-northeast-2
- name: Build
run: |
npm install
npm run build
# Upload a file to AWS s3
- name: Deploy
run: |
aws s3 cp build/ s3://${{secrets.BUCKET_NAME}}/ --recursive
# Invalidate CloudFront cache
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation --distribution-id ${{secrets.DISTRIBUTION_ID}} --paths "/*"