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.
This commit is contained in:
rcourtman 2025-11-23 09:51:51 +00:00
parent 9dc7990fbe
commit 0c7b61c989

View file

@ -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}" \