-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (64 loc) · 2.46 KB
/
deploy_production.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
name: Deploy PROD innovation.ca.gov
# site: development.innovation.ca.gov
on:
push:
branches:
- main
jobs:
build_deploy:
runs-on: ubuntu-latest
steps:
- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.15.0
- name: Build Site
run: |
npm install
npm run build
npx playwright install
npm test
# Push built site files to S3 production bucket
- name: Deploy to S3
uses: jakejarvis/[email protected]
with:
args: --follow-symlinks --delete
env:
AWS_S3_BUCKET: 'innovation.ca.gov'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
SOURCE_DIR: ./_site # only move built directory
# Reset the cache-control headers on static assets on production S3 bucket
- name: Reset cache-control on static files
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: 'us-west-1' # optional: defaults to us-east-1
source: './_site/fonts'
dest: 's3://innovation.ca.gov/fonts'
flags: --recursive --cache-control max-age=15552000
# Reset the cache-control headers on static assets on production S3 bucket
- name: Reset cache-control on static files
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: 'us-west-1' # optional: defaults to us-east-1
source: './_site/img'
dest: 's3://innovation.ca.gov/img'
flags: --recursive --cache-control max-age=15552000
# Invalidate Cloudfront production distribution
- name: invalidate
uses: chetan/[email protected]
env:
DISTRIBUTION: 'EB84S7ZI5YNKP'
PATHS: '/*'
AWS_REGION: 'us-west-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}