-
Notifications
You must be signed in to change notification settings - Fork 4
46 lines (42 loc) · 1.38 KB
/
deployment.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: Deployment
on:
push:
branches:
- main
- gh-pages
env:
NODE_VERSION: 18.x
jobs:
deplyment:
name: Deployment
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install yarn
run: npm install -g yarn
- name: Install
run: yarn install
- name: Build
run: yarn build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload to S3
run: |
aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }} --exact-timestamps --delete --region ${{ secrets.AWS_REGION }} $*
- name: Invalidate cache
run: |
if [ "${{ secrets.AWS_CF_DISTRIBUTION_ID }}" != '' ]; then
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths "/*"
else
echo "AWS_CF_DISTRIBUTION_ID is not set. Skipping cache invalidation."
fi