db/.gitea/workflows/gen-migrations.yml

44 lines
1.6 KiB
YAML
Raw Normal View History

2023-07-19 02:48:09 +00:00
name: 'gen-migrations'
on: { push: { branches: ['main'] } }
jobs:
gen-migrations:
2023-07-19 03:07:55 +00:00
if: |
!startsWith(gitea.event.head_commit.message, 'chore')
2023-07-19 02:48:09 +00:00
container:
image: 'git.orionkindel.com/dnim/db-ci-runner:disheveled-iceberg-launched-loosely'
2023-07-19 23:46:33 +00:00
volumes:
- '/run/user/1001/docker.sock:/run/user/1001/docker.sock'
- '/var/run/postgresql:/var/run/postgresql'
2023-07-19 02:48:09 +00:00
steps:
- uses: 'actions/checkout@v3'
2023-07-20 05:33:46 +00:00
with: { fetch-depth: 0, submodules: 'recursive' }
2023-07-19 02:48:09 +00:00
- 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 submodule update --init --remote migrations;
if ! (git diff-index --quiet HEAD --ignore-submodules=none); then
2023-07-19 02:48:09 +00:00
git add -A
git commit -m 'chore: update migrations'
git push
fi
- name: 'gen migrations (and push if needed)'
run: |
./scripts/gen_migrations.sh
2023-07-20 16:00:47 +00:00
cd migrations
if ! (git diff-index --quiet HEAD --ignore-submodules=none); then
2023-07-19 02:48:09 +00:00
git add -A
git commit -m 'chore: babe wake up new migrations just dropped'
git push
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