-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.4 KB
/
deploy_prod.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
name: Deploy PROD (Innovation Hub)
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_deploy:
runs-on: ubuntu-latest
steps:
- uses: n1hility/cancel-previous-runs@v3
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 readability
npm run site:build
- name: Write robots.txt
run: |
echo 'User-agent: *' > _site/robots.txt
echo 'Allow: /' >> _site/robots.txt
echo 'Sitemap: https://designsystem.webstandards.ca.gov/sitemap.xml' >> docs/robots.txt
# Push built site files to S3 production bucket
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@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
- 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 "/*"