misc: changed some things around in the autotagger
Some checks failed
Autotagger / Autotagger (push) Failing after 6s
Actions / Lint Code (Ruff & Pylint) (push) Successful in 19s
Actions / Build Documentation (MkDocs) (push) Successful in 19s

This commit is contained in:
Seaswimmer 2024-03-29 08:09:15 -04:00
parent 6c7871c36b
commit d0697dd3af
Signed by: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -25,26 +25,19 @@ jobs:
gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }} gpg_private_key : ${{ secrets.GPG_PRIVATE_KEY }}
passphrase : ${{ secrets.GPG_PASSPHRASE }} passphrase : ${{ secrets.GPG_PASSPHRASE }}
- name: Extract commit message - name: Set output variables
id: extract_commit_message id: vars
run: echo "::set-output name=message::$(git log --format=%B -n 1 $GITHUB_SHA)"
- name: Get new version
id: get_version
run: echo "::set-output name=version::$(awk -F '=' '/^ *version/ {gsub(/[[:space:]]/, "", $2); print $2}' pyproject.toml)"
- name: Get latest tag
id: get_latest_tag
run: | run: |
git fetch --tags git fetch --tags
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) echo "::set-output name=latest_tag::$(git describe --tags `git rev-list --tags --max-count=1`)"
echo "::set-output name=latest_tag::$LATEST_TAG" echo "::set-output name=version::$(awk -F '=' '/^ *version/ {gsub(/[[:space:]]/, "", $2); print $2}' pyproject.toml)"
echo "::set-output name=message::$(git log --format=%B -n 1 $GITHUB_SHA)"
- name: Compare version and latest tag - name: Compare version and latest tag
id: compare id: compare
run: | run: |
VERSION=${{ steps.get_version.outputs.version }} VERSION=${{ steps.vars.outputs.version }}
LATEST_TAG=${{ steps.get_latest_tag.outputs.latest_tag }} LATEST_TAG=${{ steps.vars.outputs.latest_tag }}
if [ "$VERSION" = "$LATEST_TAG" ]; then if [ "$VERSION" = "$LATEST_TAG" ]; then
echo "::set-output name=latest_tag::$LATEST_TAG" echo "::set-output name=latest_tag::$LATEST_TAG"
else else
@ -54,14 +47,14 @@ jobs:
- name: Create tag - name: Create tag
if: steps.compare.outputs.version if: steps.compare.outputs.version
run: | run: |
VERSION=${{ steps.get_version.outputs.version }} VERSION=${{ steps.vars.outputs.version }}
git tag -s $VERSION -m "version bumped to $VERSION" git tag -s $VERSION -m "version bumped to $VERSION"
git push origin $VERSION git push origin $VERSION
- name: Update latest tag - name: Update latest tag
if: steps.compare.outputs.latest_tag if: steps.compare.outputs.latest_tag
run: | run: |
MESSAGE=${{ steps.extract_commit_message.outputs.message }} MESSAGE=${{ steps.vars.outputs.message }}
LATEST_TAG=${{ steps.compare.outputs.latest_tag }} LATEST_TAG=${{ steps.compare.outputs.latest_tag }}
git tag -fs $LATEST_TAG -m "$MESSAGE" git tag -fs $LATEST_TAG -m "$MESSAGE"
git push origin $LATEST_TAG --force git push origin $LATEST_TAG --force