From 5e5709aa893ab74e53aba1454cc732db3010afb4 Mon Sep 17 00:00:00 2001 From: vallode <18506096+vallode@users.noreply.github.com> Date: Thu, 2 May 2024 12:08:15 +0200 Subject: [PATCH] Add update-annotations workflow --- .github/workflows/build.yml | 6 ++-- .github/workflows/update-annotations.yml | 37 ++++++++++++++++++++++++ .github/workflows/update-submodules.yml | 7 ++--- 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/update-annotations.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b513d7..fa9d932 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,14 +4,13 @@ on: push: branches: - main + workflow_call: workflow_dispatch: jobs: build: name: Build - runs-on: ubuntu-latest - permissions: - contents: write + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 with: @@ -20,6 +19,7 @@ jobs: with: bundler-cache: true - run: bundle exec rake + # TODO: Improve testing. continue-on-error: true - name: Build annotations run: bundle exec rake build diff --git a/.github/workflows/update-annotations.yml b/.github/workflows/update-annotations.yml new file mode 100644 index 0000000..e367f15 --- /dev/null +++ b/.github/workflows/update-annotations.yml @@ -0,0 +1,37 @@ +name: Update annotations + +on: + schedule: + - cron: '0 12 * * *' + workflow_dispatch: + +jobs: + run: + name: Update annotations + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - uses: ./.github/workflows/update-submodules.yml + + - uses: ./.github/workflows/build.yml + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Check if annotations changed + id: annotations_changed + run: echo "changed=$(git diff --quiet HEAD -- dist; echo $?)" >> $GITHUB_OUTPUT + + - name: Setup git user + if: ${{ steps.annotations_changed.outputs.changed == true }} + run: | + git config user.name github-actions + git config user.email github-actions@github.com + - name: Commit changes + if: ${{ steps.annotations_changed.outputs.changed == true }} + run: | + git add dfhack df-structures + git commit -m "Auto-update annotations" + git push diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index 6d4bd60..cc2dae1 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -1,14 +1,11 @@ name: Update submodules -on: - schedule: - - cron: '0 12 * * *' - workflow_dispatch: +on: workflow_call jobs: run: name: Update submodules - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: contents: write steps: