File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 workflow_dispatch :
55 schedule :
66 - cron : 0 14 * * 0
7+ push :
78
89jobs :
10+ # check if cache key already exists, only create dump if not
11+ check :
12+ runs-on : ubuntu-latest
13+ outputs :
14+ cache_count : ${{ steps.cache_count.outputs.cache_count }}
15+ steps :
16+ - uses : actions/checkout@v4
17+ - name : Check if database cache should be created
18+ id : cache_count
19+ run : echo "cache_count=$(gh cache list -k "$CACHE_KEY" --json id --jq ".| length")" >> $GITHUB_OUTPUT
20+ env :
21+ CACHE_KEY : db-${{ runner.os }}-${{ hashFiles('**/migrations/*.py') }}
22+
923 dump :
1024 runs-on : ubuntu-latest
25+ needs : check
26+ if : needs.check.outputs.cache_count == '0'
1127 steps :
1228 - uses : actions/checkout@v4
1329 - name : Start database
2440 - name : Run migrations
2541 run : python manage.py migrate --skip-checks # due to django-cms issue
2642 - name : Create database dump
27- run : docker compose -f compose-dev.yaml exec db pg_dump -U fragdenstaat_de fragdenstaat_de | gzip > dump.gz
43+ run : docker compose -f compose-dev.yaml exec db pg_dump -U fragdenstaat_de fragdenstaat_de | gzip > cache- dump.sql
2844 - name : Save dump
2945 uses : actions/cache/save@v5
3046 with :
31- path : dump.gz
32- key : ${{ runner.os }}-${{ hashFiles('compose-dev.yaml ') }}
47+ path : cache- dump.sql
48+ key : db- ${{ runner.os }}-${{ hashFiles('**/migrations/*.py ') }}
You can’t perform that action at this time.
0 commit comments