ci: skip existing tag creation and use normalized TAG for release
This commit is contained in:
22
.github/workflows/auto-versioning.yml
vendored
22
.github/workflows/auto-versioning.yml
vendored
@@ -34,7 +34,8 @@ jobs:
|
||||
run: |
|
||||
echo "Next version: ${{ steps.semver.outputs.version }}"
|
||||
|
||||
- name: Create annotated tag and push
|
||||
- id: create_tag
|
||||
name: Create annotated tag and push
|
||||
if: ${{ steps.semver.outputs.changed }}
|
||||
run: |
|
||||
# Ensure a committer identity is configured in the runner so git tag works
|
||||
@@ -46,9 +47,18 @@ jobs:
|
||||
VERSION_NO_V="${RAW#v}"
|
||||
|
||||
TAG="v${VERSION_NO_V}"
|
||||
echo "Creating tag: ${TAG}"
|
||||
git tag -a "${TAG}" -m "Release ${TAG}"
|
||||
git push origin --tags
|
||||
echo "TAG=${TAG}"
|
||||
|
||||
# If tag already exists, skip creation to avoid failure
|
||||
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
|
||||
echo "Tag ${TAG} already exists; skipping tag creation"
|
||||
else
|
||||
git tag -a "${TAG}" -m "Release ${TAG}"
|
||||
git push origin "${TAG}"
|
||||
fi
|
||||
|
||||
# Export the tag for downstream steps
|
||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -56,8 +66,8 @@ jobs:
|
||||
if: ${{ steps.semver.outputs.changed }}
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.semver.outputs.version }}
|
||||
name: Release ${{ steps.semver.outputs.version }}
|
||||
tag_name: ${{ steps.create_tag.outputs.tag }}
|
||||
name: Release ${{ steps.create_tag.outputs.tag }}
|
||||
body: ${{ steps.semver.outputs.release_notes }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user