68 lines (59 loc) · 2.06 KB
/
update.yaml
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
name: ML-Pipeline
on:
push:
branches:
- main
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
run-model:
runs-on: self-hosted
if: "!contains(github.event.head_commit.message, 'Update resources')"
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
# Setup repository secrets and VPN connection
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Install git-secret
env:
PASSWORD: ${{secrets.PASSWORD}}
run: |
echo "$PASSWORD" | sudo -S apt-get update &&
echo "$PASSWORD" | sudo -S apt-get install -y git-secret
- name: Reveal secrets
run: git secret reveal
# Build and run pipeline
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Setup Poetry
uses: Gr1N/setup-poetry@v7
- uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: poetry install
- name: Setup Environment
run: cp model/.env.prod model/.env
- name: Run ML pipeline
run: |
poetry run jupyter nbconvert --to html --template lab --execute model/Incidence_nowcast.ipynb
# Push updates to repo
- name: Commit updates
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m"Update resources"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}