This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
66 lines (58 loc) · 2.33 KB
/
eleventy_build.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
name: Eleventy Build Master
on:
push:
branches:
- master
jobs:
build_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build 11ty
run: |
npm install
npm run build
- name: Save Commit Context
uses: finnp/create-file-action@master
env:
FILE_NAME: "./docs/commit-info.json"
FILE_DATA: ${{ toJson(github.event.commits) }}
- name: Use Node.js
uses: actions/setup-node@v4
- name: npm test
run: |
npm run test:setup
npm test
env:
CI: true
# Deploy to this branch that Azure workflow watches for changes and deploys to Azure production
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./docs
publish_branch: deploy_production
commit_message: ${{ github.event.head_commit.message }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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 ./docs s3://covid19.ca.gov
- name: Reset cache-control on static fonts
run: aws s3 sync --cache-control max-age=15552000 ./docs/fonts s3://covid19.ca.gov/fonts
# the original version of this was writing to the fonts directory (invalid)
# i suspect this is not actually needed
- name: Reset cache-control on static img
run: aws s3 sync --cache-control max-age=15552000 ./docs/img s3://covid19.ca.gov/img
# Create all the redirects on S3, only do this on production we don't want this set of redirects in all environments
- name: Deploy redirects
run: |
AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} npm run deploy:redirects
- name: invalidate Cloudfront
run: AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id EUZDM53N8V5KD --paths "/*"