Enhance release workflow to check for existing tags locally and on remote before creating new tags, improving error handling and feedback during the tagging process.

This commit is contained in:
Luke Hagar
2025-09-26 17:56:38 +00:00
parent 5968ea389c
commit 3aefb4b1c4

View File

@@ -124,11 +124,24 @@ jobs:
shell: bash
run: |
TAG="v${{ steps.final-version.outputs.version }}"
# Check if tag exists locally
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists."
echo "Tag $TAG already exists locally."
# Try to push it anyway (in case it's not on remote)
if git push origin "$TAG" 2>/dev/null; then
echo "Successfully pushed existing tag $TAG to remote."
else
echo "Tag $TAG already exists on remote as well."
fi
else
echo "Creating new tag $TAG"
git tag "$TAG" ${{ github.event.workflow_run.head_sha }}
git push origin "$TAG"
if git push origin "$TAG" 2>/dev/null; then
echo "Successfully created and pushed tag $TAG"
else
echo "Tag $TAG already exists on remote, skipping push."
fi
fi
# Publish to npm (requires NPM_TOKEN in repo secrets)