Wordpress Media Update #1299
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 | |
concurrency: # replaces use of n1hility/cancel-previous-runs | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# - uses: n1hility/cancel-previous-runs@master | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@master | |
- name: Use Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: 18.15.0 | |
- name: Build Site | |
run: | | |
npm install | |
npm run build | |
npx playwright install | |
npm test | |
- name: Write robots.txt | |
run: | | |
echo 'User-agent: *' > _site/robots.txt | |
echo 'Allow: /' >> _site/robots.txt | |
echo 'Sitemap: https://innovation.ca.gov/sitemap.xml' >> _site/robots.txt | |
# 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 }} |