diff --git a/.gitea/workflows/gen-migrations.yml b/.gitea/workflows/gen-migrations.yml new file mode 100644 index 0000000..84838bc --- /dev/null +++ b/.gitea/workflows/gen-migrations.yml @@ -0,0 +1,40 @@ +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:disheveled-iceberg-launched-loosely' + volumes: ['/run/user/1001/docker.sock:/run/user/1001/docker.sock'] + steps: + - uses: 'actions/checkout@v3' + with: { fetch-depth: 0, ref: 'main', submodules: 'recursive' } + - 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 --cached HEAD --) ]]; then + git add -A + git commit -m 'chore: update migrations' + git push + fi + - name: 'gen migrations (and push if needed)' + run: | + ./scripts/gen_migrations.sh + if [[ ! (git diff-index --quiet --cached HEAD --) ]]; then + cd migrations + 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 diff --git a/.gitea/workflows/migrate-devel.yml b/.gitea/workflows/migrate-devel.yml index 0751b2f..2618a6b 100644 --- a/.gitea/workflows/migrate-devel.yml +++ b/.gitea/workflows/migrate-devel.yml @@ -8,7 +8,7 @@ jobs: volumes: ['/run/user/1001/docker.sock:/run/user/1001/docker.sock'] steps: - uses: 'actions/checkout@v3' - with: { fetch-depth: 0, ref: 'main' } + with: { fetch-depth: 0, ref: 'main', submodules: 'recursive' } - run: './scripts/migrate.sh' env: DOCKER_HOST: 'unix:///run/user/1001/docker.sock' # HACK: rootless docker on gitea action runner diff --git a/.gitea/workflows/migrate-stage.yml b/.gitea/workflows/migrate-stage.yml index f4adaf9..371ea89 100644 --- a/.gitea/workflows/migrate-stage.yml +++ b/.gitea/workflows/migrate-stage.yml @@ -8,7 +8,7 @@ jobs: volumes: ['/run/user/1001/docker.sock:/run/user/1001/docker.sock'] steps: - uses: 'actions/checkout@v3' - with: { fetch-depth: 0, ref: 'main' } + with: { fetch-depth: 0, ref: 'main', submodules: 'recursive' } - run: './scripts/migrate.sh' env: DOCKER_HOST: 'unix:///run/user/1001/docker.sock' # HACK: rootless docker on gitea action runner