-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 1.9 KB
/
deployfe.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
63
64
65
66
67
68
69
70
71
72
73
74
name: Deploy Production to s3/Cloudfront
on:
workflow_dispatch:
release:
types: [published]
env:
AWS_REGION: us-west-2
jobs:
build_fe:
name: Build and Test
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '21.6.2'
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- name: install dependencies and build
run: |
cd frontend
npm install
npm run build
- name: Move Build to tmp
run: |
mkdir -p /tmp/workspace/build
mv -v frontend/build/* /tmp/workspace/build
- name: Temporarily save Build to artifacts
uses: actions/upload-artifact@v2
with:
name: build-client
path: /tmp/workspace
deploy_fe:
needs: build_fe
runs-on: ubuntu-latest
environment: production
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Retrieve saved Build
uses: actions/download-artifact@v2
with:
name: build-client
path: /tmp/workspace
- name: Deploy to S3
run: aws s3 sync /tmp/workspace/build/ s3://pv-validation-hub-website --acl public-read
- name: Run CF invalidation
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.FE_CF_ID }} --paths '/*'