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 4
87 lines (75 loc) · 3.15 KB
/
upload-to-s3.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Upload To Amazon S3 / Clear Cloudfront cache
on:
push: # only on pushes to main that involve pdf/ or img/
branches:
- main
paths:
- 'pdf/**'
- 'img/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: mkdir -p sitemap
- run: HOMEDIR=$HOME npm run updateSitemap
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
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 (site map)
run: aws s3 sync --acl public-read --follow-symlinks ./sitemap s3://files.covid19.ca.gov
- name: Deploy to S3 (./pdf)
run: aws s3 sync --acl public-read --follow-symlinks --delete ./pdf s3://files.covid19.ca.gov/pdf
- name: Deploy to S3 (./img)
run: aws s3 sync --acl public-read --follow-symlinks --delete ./img s3://files.covid19.ca.gov/img
- name: invalidate Cloudfront
run: aws cloudfront create-invalidation --distribution-id E21D0URMALUUJ4 --paths "/pdf*" "/img*" /sitemap.xml
# # Push the site map to S3 data
# - name: Deploy to S3 (PDFs)
# uses: jakejarvis/[email protected]
# with:
# args: --acl public-read --follow-symlinks
# env:
# AWS_S3_BUCKET: 'files.covid19.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'
# SOURCE_DIR: ./sitemap
# # Push built site files to S3 production bucket (files)
# - name: Deploy to S3 (PDFs -> files)
# uses: jakejarvis/[email protected]
# with:
# args: --acl public-read --follow-symlinks --delete
# env:
# AWS_S3_BUCKET: 'files.covid19.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'
# SOURCE_DIR: ./pdf
# DEST_DIR: pdf
# - name: Deploy to S3 (img -> files)
# uses: jakejarvis/[email protected]
# with:
# args: --acl public-read --follow-symlinks --delete
# env:
# AWS_S3_BUCKET: 'files.covid19.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'
# SOURCE_DIR: ./img
# DEST_DIR: img
# #
# # Invalidate Cloudfront production distribution for files.covid19.ca.gov/pdf
# - name: invalidate
# uses: chetan/[email protected]
# env:
# DISTRIBUTION: 'E21D0URMALUUJ4'
# PATHS: '/pdf /pdf/* /img /img/* /data /data/*'
# AWS_REGION: 'us-west-1'
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}