45 lines
1.7 KiB
YAML
45 lines
1.7 KiB
YAML
name: 'gen-migrations'
|
|
on: { push: { branches: ['main'] } }
|
|
|
|
jobs:
|
|
gen-migrations:
|
|
if: |
|
|
!startsWith(gitea.event.head_commit.message, 'chore')
|
|
container:
|
|
image: 'git.orionkindel.com/dnim/db-ci-runner:specified-policeman-saw-kindly'
|
|
volumes:
|
|
- '/run/user/1001/docker.sock:/run/user/1001/docker.sock'
|
|
- '/var/run/postgresql:/var/run/postgresql'
|
|
steps:
|
|
- uses: 'actions/checkout@v3'
|
|
with: { fetch-depth: 0, submodules: 'recursive', token: '${{ secrets._GITEA_TOKEN }}' }
|
|
- name: 'git config'
|
|
run: |
|
|
git config --global user.email 'noreply@dnim.org'
|
|
git config --global user.name '🤖'
|
|
- name: 'update migrations submodule (and push if needed)'
|
|
run: |
|
|
set -ex
|
|
git fetch --all --recurse-submodules
|
|
git submodule update --init --remote migrations;
|
|
git add -A
|
|
git commit -m 'chore: update migrations' || true
|
|
git push || true
|
|
- name: 'gen migrations (and push if needed)'
|
|
run: |
|
|
set -ex
|
|
./scripts/gen_migrations.sh
|
|
if ! (git diff-index --quiet HEAD --ignore-submodules=none); then
|
|
cd migrations
|
|
git switch migrations
|
|
git add -A
|
|
git commit -m 'chore: babe wake up new migrations just dropped'
|
|
git push -u origin migrations
|
|
cd ../
|
|
git add -A
|
|
git commit -m 'chore: update migrations'
|
|
git push
|
|
fi
|
|
env:
|
|
DOCKER_HOST: 'unix:///run/user/1001/docker.sock' # HACK: rootless docker on gitea action runner
|