-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (50 loc) · 1.66 KB
/
ci-cd.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
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm install
- name: Create production build
run: npm run build
env:
CI: ""
LEAFLET_API_KEY: "${{ secrets.LEAFLET_API_KEY }}"
REACT_APP_BASEURL: "${{ secrets.REACT_APP_BASEURL }}"
REACT_APP_SOCKET_BASEURL: "${{ secrets.REACT_APP_SOCKET_BASEURL }}"
REACT_APP_LOCATION_IQ_API_KEY: "${{ secrets.REACT_APP_LOCATION_IQ_API_KEY }}"
- name: Share artifact inside workflow
uses: actions/upload-artifact@v3
with:
name: sportflix-build
path: build
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Downloading Artifact
uses: actions/download-artifact@v3
with:
name: sportflix-build
path: sportflix_build
# - name: Show files
# run: ls -R
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Deploy static site to S3 bucket
run: aws s3 sync ./sportflix_build/ s3://${{ secrets.AWS_BUCKET }} --delete
- name: Invalidate cloudfront cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID }} --paths "/*"