added autotagger
All checks were successful
Actions / Build Documentation (push) Successful in 12s
Actions / Build Export Files (push) Successful in 4s

This commit is contained in:
SeaswimmerTheFsh 2024-03-11 20:27:49 -04:00
parent aa216b2f09
commit 0381749572
Signed by: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -0,0 +1,43 @@
name: Autotagger
on:
push:
branches:
- 'master'
jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Extract commit message
id: extract_commit_message
run: echo "::set-output name=message::$(git log --format=%B -n 1 $GITHUB_SHA)"
- name: Check commit message
id: check_commit_message
run: |
COMMIT_MESSAGE=$(echo "${{ steps.extract_commit_message.outputs.message }}")
if [[ $COMMIT_MESSAGE =~ ^Version\ bumped\ to\ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then
echo "Found version bump in commit message."
echo "::set-output name=version::${BASH_REMATCH[1]}"
else
echo "No version bump found in commit message."
LATEST_TAG=$(git describe --tags --abbrev=0)
echo "::set-output name=latest_tag::$LATEST_TAG"
fi
- name: Create or update tag
if: steps.check_commit_message.outputs.version
run: |
VERSION=${{ steps.check_commit_message.outputs.version }}
git tag -a $VERSION -m "Version bumped to $VERSION"
git push origin $VERSION
- name: Force update latest tag
if: steps.check_commit_message.outputs.latest_tag
run: |
COMMIT_MESSAGE=$(echo "${{ steps.extract_commit_message.outputs.message }}")
LATEST_TAG=${{ steps.check_commit_message.outputs.latest_tag }}
git tag -fa $LATEST_TAG -m $COMMIT_MESSAGE
git push origin $LATEST_TAG --force