-
-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (36 loc) · 1.29 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
on:
schedule:
# Every day after globe_history has been uploaded
- cron: '21 5 * * *'
# But also on push
push:
branches:
- main
jobs:
update-db:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update database
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -ex
# We are idempotent
# We try not to exit with an error code
# We push if the files have changed, otherwise we do not
# Install dependencies
sudo apt-get -y install python3-pip python3-dev
pip3 install --no-cache-dir -r requirements.txt
# Run the script that affects RELEASES.md and PREFERRED_RELEASES.txt
python3 update-releases.py
# Now we try adding them, if they have changed
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add RELEASES.md PREFERRED_RELEASES.txt README.md ALL_RELEASES.txt
# Have we actually changed anything?
if ! git diff-index --quiet HEAD --; then
# We have changed something, so we commit and push
git commit -m "Update RELEASES.md and PREFERRED_RELEASES.txt"
git push
fi