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:
parent
9dc7990fbe
commit
0c7b61c989
1 changed files with 2 additions and 12 deletions
14
.github/workflows/create-release.yml
vendored
14
.github/workflows/create-release.yml
vendored
|
|
@ -407,15 +407,6 @@ jobs:
|
||||||
echo "Release notes content:"
|
echo "Release notes content:"
|
||||||
cat "$NOTES_FILE"
|
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
|
- name: Create draft release
|
||||||
id: create_release
|
id: create_release
|
||||||
env:
|
env:
|
||||||
|
|
@ -426,9 +417,8 @@ jobs:
|
||||||
|
|
||||||
echo "Creating draft release for ${TAG}..."
|
echo "Creating draft release for ${TAG}..."
|
||||||
|
|
||||||
# Use GitHub API directly to create release with existing tag
|
# GitHub API creates both the tag and release
|
||||||
# gh release create has issues when tag already exists
|
# If tag exists, it creates "untagged" release - so DON'T create tag first
|
||||||
# Must include target_commitish to link to existing tag
|
|
||||||
RELEASE_JSON=$(gh api "repos/${{ github.repository }}/releases" \
|
RELEASE_JSON=$(gh api "repos/${{ github.repository }}/releases" \
|
||||||
-X POST \
|
-X POST \
|
||||||
-F tag_name="${TAG}" \
|
-F tag_name="${TAG}" \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue