From e6305be04f687b1f3801abc9cb58ffd68ce842ab Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 18 Sep 2025 13:07:07 +0200 Subject: [PATCH] Add workflow to bump build.func revision --- .github/workflows/revision-bump.yml | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/revision-bump.yml diff --git a/.github/workflows/revision-bump.yml b/.github/workflows/revision-bump.yml new file mode 100644 index 00000000..6e15d75b --- /dev/null +++ b/.github/workflows/revision-bump.yml @@ -0,0 +1,44 @@ +name: Bump build.func Revision + +on: + push: + branches: [ main ] + paths: + - 'misc/*.func' + - 'misc/*.sh' + +jobs: + bump-revision: + runs-on: ubuntu-latest + if: github.event.head_commit.author.name != 'github-actions[bot]' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Detect misc changes + id: changes + run: | + git diff --name-only HEAD^ HEAD > changed_files.txt + echo "changed=$(cat changed_files.txt)" >> $GITHUB_OUTPUT + + - name: Bump Revision if needed + if: contains(steps.changes.outputs.changed, 'misc/') && !contains(steps.changes.outputs.changed, 'misc/build.func') + run: | + REV_FILE=".build-revision" + if [ ! -f "$REV_FILE" ]; then echo 0 > "$REV_FILE"; fi + REV_NUM=$(($(cat $REV_FILE) + 1)) + echo $REV_NUM > $REV_FILE + SHORT_SHA=$(git rev-parse --short HEAD) + REV_STR="Revision: r${REV_NUM} (git-${SHORT_SHA})" + sed -i "s/^# Revision:.*/# $REV_STR/" misc/build.func + echo "REV_STR=$REV_STR" >> $GITHUB_ENV + + - name: Commit & push revision + if: contains(steps.changes.outputs.changed, 'misc/') && !contains(steps.changes.outputs.changed, 'misc/build.func') + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add misc/build.func .build-revision + git commit -m "chore: bump build.func to $REV_STR" + git push