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 0
142 lines (120 loc) · 5.67 KB
/
track-multi-publish.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Track data updates
on:
push:
branches:
- main
- CovidStateDashboardTables_Staging
paths:
- 'data/daily-stats-v2.json'
- 'data/reviewed/equitydash/equitytopboxdatav2.json'
- 'data/dashboard/vaccines/sparkline.json'
- 'data/dashboard/combined-cases/california.json'
- 'data/dashboard/confirmed-deaths/california.json'
- 'data/dashboard/positivity-rate/california.json'
- 'data/dashboard/total-tests/california.json'
- 'data/dashboard/patients/california.json'
- 'data/dashboard/icu-beds/california.json'
- 'data/dashboard/postvax/california.json'
- 'data/variants/california.json'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# wait for initial s3 upload to finish
- name: sleep 60
run: sleep 60
- uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "UTC"
- uses: actions/checkout@v2
with:
fetch-depth: 2 # OR "2" -> To retrieve the preceding commit.
- name: Verify Changed files
id: changed-files
uses: tj-actions/changed-files@v2.0.0
# - name: debugging
# run: |
# echo "FILES CHANGED"
# for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
# echo "$file was changed"
# done
- name: git config
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git config pull.rebase true
- name: Update time stamp (cases)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/combined-cases/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_cases_update.json
git add data/status/last_cases_update.json
- name: Update time stamp (dashboard)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/daily-stats-v2.json')
run: |
node src/logUpdateTime.js ./data/status/last_dashboard_update.json
git add data/status/last_dashboard_update.json
- name: Update time stamp (equity)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/reviewed/equitydash/equitytopboxdatav2.json')
run: |
node src/logUpdateTime.js ./data/status/last_equity_update.json
git add data/status/last_equity_update.json
- name: Update time stamp (vax)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/vaccines/sparkline.json')
run: |
node src/logUpdateTime.js ./data/status/last_vax_update.json
git add data/status/last_vax_update.json
- name: Update time stamp (deaths)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/confirmed-deaths/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_deaths_update.json
git add data/status/last_deaths_update.json
- name: Update time stamp (totaltests)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/total-tests/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_totaltests_update.json
git add data/status/last_totaltests_update.json
- name: Update time stamp (posrate)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/positivity-rate/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_posrate_update.json
git add data/status/last_posrate_update.json
- name: Update time stamp (patients)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/patients/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_patients_update.json
git add data/status/last_patients_update.json
- name: Update time stamp (icu-beds)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/icu-beds/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_icubeds_update.json
git add data/status/last_icubeds_update.json
- name: Update time stamp (postvax)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/dashboard/postvax/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_postvax_update.json
git add data/status/last_postvax_update.json
- name: Update time stamp (variants)
if: contains(steps.changed-files.outputs.all_changed_files, 'data/variants/california.json')
run: |
node src/logUpdateTime.js ./data/status/last_variants_update.json
git add data/status/last_variants_update.json
- name: update all changed timestamps to git
run: |
git commit -m "freshened update status times"
git pull origin ${GITHUB_REF_NAME}
git push origin ${GITHUB_REF_NAME}
- 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
# Push built site files to S3 production bucket
- name: Deploy to S3 (data/status)
run: aws s3 sync --follow-symlinks --delete ./data/status s3://data.covid19.ca.gov/data/status
#
# Invalidate Cloudfront production distribution
- name: invalidate Cloudfront
run: aws cloudfront create-invalidation --distribution-id EHNPIZWYYWA31 --paths "/data/status*"