From 0c7b61c989b2ddc20bdc9f4af15eca5d8fbe03e0 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sun, 23 Nov 2025 09:51:51 +0000 Subject: [PATCH] Fix: let GitHub API create the tag, don't pre-create it GitHub's API has a quirk: if you POST to /releases with a tag_name that already exists as a git tag, it creates an 'untagged' release instead of attaching to the existing tag. The fix is to let the API create both tag and release together. --- .github/workflows/create-release.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 52912e3..945ee05 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -407,15 +407,6 @@ jobs: echo "Release notes content:" cat "$NOTES_FILE" - - name: Create git tag - run: | - TAG="${{ needs.extract_version.outputs.tag }}" - - echo "Creating git tag ${TAG}..." - git tag "${TAG}" "${{ github.sha }}" - git push origin "${TAG}" - echo "✓ Tag ${TAG} created and pushed" - - name: Create draft release id: create_release env: @@ -426,9 +417,8 @@ jobs: echo "Creating draft release for ${TAG}..." - # Use GitHub API directly to create release with existing tag - # gh release create has issues when tag already exists - # Must include target_commitish to link to existing tag + # GitHub API creates both the tag and release + # If tag exists, it creates "untagged" release - so DON'T create tag first RELEASE_JSON=$(gh api "repos/${{ github.repository }}/releases" \ -X POST \ -F tag_name="${TAG}" \