hopefully properly escape autotagger stuff and switch off of ::set-output
Some checks failed
Actions / Build Export Files (push) Successful in 7s
Actions / Autotagger (push) Failing after 10s
Actions / Build Documentation (push) Has been cancelled

This commit is contained in:
cswimr 2024-10-21 14:23:36 -04:00
parent 135c9dad86
commit 875c98e0c7
Signed by: cswimr
GPG key ID: A9C162E867C851FA

View file

@ -123,36 +123,39 @@ jobs:
- name: Extract commit message - name: Extract commit message
id: extract_commit_message id: extract_commit_message
run: echo "::set-output name=message::$(git log --format=%B -n 1 $GITHUB_SHA)" run: |
COMMIT_MESSAGE=$(git log --format=%B -n 1 $GITHUB_SHA)
ESCAPED_COMMIT_MESSAGE="${COMMIT_MESSAGE@Q}"
echo "message=$ESCAPED_COMMIT_MESSAGE" >> $GITHUB_OUTPUT
- name: Check commit message - name: Check commit message
id: check_commit_message id: check_commit_message
shell: bash shell: bash
run: | run: |
COMMIT_MESSAGE="${{ steps.extract_commit_message.outputs.message }}" COMMIT_MESSAGE="${{ steps.extract_commit_message.outputs.message }}"
OUTPUT="$(python .forgejo/workflows/scripts/message.py "${ESCAPED_COMMIT_MESSAGE@Q}")" OUTPUT="$(python .forgejo/workflows/scripts/message.py "${COMMIT_MESSAGE@Q}")"
if [ "$OUTPUT" = "Usage: python message.py <commit_message>" ]; then if [ "$OUTPUT" = "Usage: python message.py <commit_message>" ]; then
echo "Called without commit message!" echo "Called without commit message!"
exit 1 exit 1
elif [ "$OUTPUT" = "None" ]; then elif [ "$OUTPUT" = "None" ]; then
echo "No version bump." echo "No version bump."
echo "::set-output name=latest_tag::$(git describe --tags --abbrev=0)" echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
else else
echo "Version bump detected: $OUTPUT" echo "Version bump detected: $OUTPUT"
echo "::set-output name=version::$OUTPUT" echo "version=$OUTPUT" >> $GITHUB_OUTPUT
fi fi
- name: Create tag - name: Create tag
if: steps.check_commit_message.outputs.version if: steps.check_commit_message.outputs.version != ''
run: | run: |
VERSION=${{ steps.check_commit_message.outputs.version }} VERSION=${{ steps.check_commit_message.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.check_commit_message.outputs.latest_tag if: steps.check_commit_message.outputs.latest_tag != ''
run: | run: |
COMMIT_MESSAGE="$(echo "${{ steps.extract_commit_message.outputs.message }}")" COMMIT_MESSAGE="$(steps.extract_commit_message.outputs.message)"
LATEST_TAG="${{ steps.check_commit_message.outputs.latest_tag }}" LATEST_TAG="${{ steps.check_commit_message.outputs.latest_tag }}"
git tag -fs $LATEST_TAG -m "$COMMIT_MESSAGE" git tag -fs $LATEST_TAG -m "$COMMIT_MESSAGE"
git push origin $LATEST_TAG --force git push origin $LATEST_TAG --force