mirror of
https://github.com/LukeHagar/prettier-plugin-openapi.git
synced 2025-12-10 12:47:48 +00:00
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:
17
.github/workflows/release.yml
vendored
17
.github/workflows/release.yml
vendored
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user