-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (52 loc) · 1.67 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: deploy
on:
push:
branches: ["main"]
jobs:
deployment:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
id-token: write
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '10'
- name: npm install
run: npm ci
- name: Build
run: npx parcel build src/index.js --no-source-maps
- name: AWS - authentication
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: 'eu-central-1'
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
- name: Upload files for V2 (AWS S3)
run: |
aws s3 cp \
--cache-control max-age=86400 \
./dist/index.css s3://parcellab-cdn/css/v2/parcelLab.min.css
aws s3 cp \
--cache-control max-age=86400 \
./dist/index.js s3://parcellab-cdn/js/v2/parcelLab.min.js
- name: Upload files for V3 (AWS S3)
run: |
aws s3 cp \
--cache-control max-age=86400 \
./dist/index.css s3://parcellab-cdn/css/v3/parcelLab.min.css
aws s3 cp \
--cache-control max-age=86400 \
./dist/index.js s3://parcellab-cdn/js/v3/parcelLab.min.js
- name: Clear the CDN cache (CloudFront)
run: |
aws cloudfront create-invalidation \
--distribution-id E3R5S2BJQI4RDS \
--paths \
"/css/v2/parcelLab.min.css" \
"/js/v2/parcelLab.min.js" \
"/css/v3/parcelLab.min.css" \
"/js/v3/parcelLab.min.js"