Fix: use GitHub API directly for release creation

gh release create doesn't work properly when the tag already exists -
it creates an 'untagged' release instead of attaching to the existing tag.

Using the API directly with POST to /releases fixes this.
This commit is contained in:
rcourtman 2025-11-23 09:24:04 +00:00
parent 1586f80208
commit c50869023d

View file

@ -426,18 +426,17 @@ jobs:
echo "Creating draft release for ${TAG}..."
# Tag now exists, so gh release create will attach to it
gh release create "${TAG}" \
--draft \
--title "Pulse ${TAG}" \
--notes-file "$NOTES_FILE"
# Use GitHub API directly to create release with existing tag
# gh release create has issues when tag already exists
RELEASE_JSON=$(gh api "repos/${{ github.repository }}/releases" \
-X POST \
-F tag_name="${TAG}" \
-F name="Pulse ${TAG}" \
-F body="$(cat $NOTES_FILE)" \
-F draft=true)
rm -f "$NOTES_FILE"
# Get the release ID
echo "Fetching release details..."
RELEASE_JSON=$(gh api "repos/${{ github.repository }}/releases/tags/${TAG}")
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id')
RELEASE_URL=$(echo "$RELEASE_JSON" | jq -r '.html_url')