-
Notifications
You must be signed in to change notification settings - Fork 6
81 lines (79 loc) · 2.95 KB
/
scheduled.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
name: Fetch latest data and deploy with Datasette
on:
push:
branches:
- master
workflow_dispatch:
schedule:
- cron: '5 * * * *'
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Check out corvid-19-datasette
uses: actions/checkout@v2
- name: Check out CSSEGISandData/COVID-19
uses: actions/checkout@v2
with:
repository: CSSEGISandData/COVID-19
path: COVID-19
- name: Check out nytimes/covid-19-data
uses: actions/checkout@v2
with:
repository: nytimes/covid-19-data
path: covid-19-data
- name: Check out LA Times datadesk/california-coronavirus-data
uses: actions/checkout@v2
with:
repository: datadesk/california-coronavirus-data
path: california-coronavirus-data
- name: Check out Economist TheEconomist/covid-19-excess-deaths-tracker
uses: actions/checkout@v2
with:
repository: TheEconomist/covid-19-excess-deaths-tracker
path: covid-19-excess-deaths-tracker
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build covid.db database
run: python build_database.py
- name: Set variables to decide if we should deploy
id: decide_variables
run: |-
echo "##[set-output name=latest;]$(datasette inspect covid.db | jq '.covid.hash' -r)"
echo "##[set-output name=deployed;]$(curl -s https://covid-19.datasettes.com/-/databases.json | jq '.[0].hash' -r)"
- name: Set up Cloud Run
if: github.event_name == 'workflow_dispatch' || steps.decide_variables.outputs.latest != steps.decide_variables.outputs.deployed
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '275.0.0'
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Deploy to Cloud Run
if: github.event_name == 'workflow_dispatch' || steps.decide_variables.outputs.latest != steps.decide_variables.outputs.deployed
run: |-
gcloud config set run/region us-central1
gcloud config set project datasette-222320
datasette publish cloudrun covid.db \
--service covid-19 \
--branch 0.50a1 \
-m metadata.json \
--memory 2Gi \
--install=datasette-vega \
--install=datasette-copyable \
--install="datasette-graphql>=0.12" \
--install="datasette-yaml==0.1a" \
--install=datasette-atom \
--extra-options="--config facet_time_limit_ms:3000 --config sql_time_limit_ms:3000"