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)