This repository has been archived by the owner on Sep 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (59 loc) · 2.07 KB
/
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
66
name: build-and-deploy
on:
schedule:
- cron: '6 6 * * MON-FRI'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Cleanup pre-installed tools
run: |
# This is a fix for https://github.com/actions/virtual-environments/issues/1918
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- uses: actions/setup-python@v3
with:
python-version: '3.10'
- uses: r-lib/actions/setup-r@v2
with:
r-version: '4.2.0'
- uses: r-lib/actions/setup-renv@v2
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: poetry install
- 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: eu-central-1
- name: Build
run: poetry run python src/build.py ${{ secrets.MONKEYPOX_BUCKET }}
- name: Commit and push
run: |
git pull
git add build
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Report update $(date +'%Y-%m-%d')" || echo "Nothing changed since last run"
git push --set-upstream origin main
- name: Deploy (copy to S3)
run: |
aws s3 sync build/ s3://www.monkeypox.global.health/$(date +'%Y-%m-%d')/
aws s3 sync build/ s3://www.monkeypox.global.health/
- name: Create archives
run: poetry run python src/archives.py
- name: Deploy (invalidate cache)
run: |
aws cloudfront create-invalidation \
--distribution-id EG7WS3LXZ4NO \
--paths / /index.html /archives/ /archives/index.html \
/index.json /style.css '/figures/*' "/$(date +'%Y-%m-%d')/*"