From 3aefb4b1c4efeec10f72ba6ee5f8f5199e7fd0d6 Mon Sep 17 00:00:00 2001 From: Luke Hagar Date: Fri, 26 Sep 2025 17:56:38 +0000 Subject: [PATCH] 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. --- .github/workflows/release.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d8b2e8..a9c743a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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)