Merge pull request #235 from cagov/november-team-update-2 #809
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
npm run readability | |
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 }} |