Skip to content

Commit

Permalink
Auto-tag whenever version in MODULE.bazel changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hzeller committed May 25, 2024
1 parent 9c3dfd9 commit ba65495
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,42 @@ jobs:
with:
name: ${{ env.OUT }}
path: ${{ env.OUT }}.tar.gz

release-tagging:
name: Version Tagging
runs-on: ubuntu-24.04
#if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/main')}}
permissions:
contents: write

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Tag with MODULES.bazel version if not already.
run: |
version_from_module_bazel() {
git annotate -l MODULE.bazel \
| awk '/module/ { in_module=1; }
/version/ { if (in_module) { print $0; nextfile; } }' \
| sed 's/\(^[0-9a-f]*\).*version[ ]*=[ ]*"\([0-9.]*\)".*/\1 \2/p;d'
}
#git config --local user.name "Development Bot"
#git config --local user.email "devel@bant.build"
# We want to tag whenever the version in MODULE.bazel changes.
# So extract the hash of when the current version was entered.
read TAG_HASH TAG_VERSION <<<$(version_from_module_bazel)
echo "Bant Version v${TAG_VERSION} at hash ${TAG_HASH}"
# If this is the first time we see this tag: apply.
#if [ -z "$(git tag -l "v${TAG_VERSION}")" ]; then
# git tag -a "v${TAG_VERSION}" ${TAG_HASH} -m "Update to v${TAG_VERSION}"
# git push origin "v${TAG_VERSION}"
#else
# echo "Tag already applied"
#fi

0 comments on commit ba65495

Please sign in to comment.