-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (66 loc) · 2.11 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Update AED
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Extract nixpkgs hash
run: |
nixpkgs_hash=$(grep -o -P '(?<=archive/)[0-9a-f]{40}(?=\.tar\.gz)' shell.nix)
echo "NIXPKGS_HASH=$nixpkgs_hash" >> $GITHUB_ENV
- name: Cache Nix store
uses: actions/cache@v4
id: nix-cache
with:
key: nix-${{ runner.os }}-${{ env.NIXPKGS_HASH }}
path: /tmp/nix-cache
- name: Import Nix store cache
if: steps.nix-cache.outputs.cache-hit == 'true'
run: |
nix-store --import < /tmp/nix-cache
- name: Cache Python venv
uses: actions/cache@v4
with:
key: python-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
path: |
~/.cache/pypoetry
.venv
- name: Install dependencies
run: |
nix-shell --pure --run true
- name: Cache OSM data
uses: actions/cache@v4
id: osm-cache
with:
key: cache
path: /tmp/osm-cache
- name: Import .osm_cache.json
if: steps.osm-cache.outputs.cache-hit == 'true'
run: |
cp /tmp/osm-cache/.osm_cache.json .
- name: Update AED
run: |
nix-shell --pure --run "python main.py"
- name: Export .osm_cache.json
run: |
mkdir -p /tmp/osm-cache
cp .osm_cache.json /tmp/osm-cache
- name: Export Nix store cache
if: steps.nix-cache.outputs.cache-hit != 'true'
run: |
nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nix-cache
- name: Commit changes
run: |
status=$(cat status.txt)
git config user.name github-actions
git config user.email [email protected]
(git commit -am "Update AED ($status)" && git push) || true