Merge pull request #82 from cagov/jul-1-plain-language-course #239
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 Hub) | |
on: | |
push: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
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@v3 | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@master | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 18.15.0 | |
- name: Build Site | |
run: | | |
npm install | |
npm run build | |
npm run readability | |
npm run build | |
- name: Write robots.txt | |
run: | | |
echo 'User-agent: *' > _site/robots.txt | |
echo 'Allow: /' >> _site/robots.txt | |
echo 'Sitemap: https://hub.innovation.ca.gov/sitemap.xml' >> _site/robots.txt | |
# Push built site files to S3 production bucket | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@master | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-1 | |
- name: Deploy to S3 | |
run: aws s3 sync --follow-symlinks --delete ./_site s3://hub.innovation.ca.gov | |
- name: invalidate Cloudfront | |
run: AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id E10PBAXC9T5GAR --paths "/*" |