fix(ci): create GitHub releases on the dispatched v-prefixed tag (1.10.1) (#13609)

fix(ci): create GitHub releases on the dispatched v-prefixed tag

The create_release job passed the bare version (v stripped) as the
release tag with no commit target, so when that tag did not exist
GitHub minted a new lightweight tag at the default-branch HEAD -- the
wrong commit, still carrying the previous version (main only adopts a
release's version via the post-release back-merge). Every release since
1.8.2 shipped a stray bare tag (1.8.2, 1.8.3, 1.9.0-1.9.6, 1.10.0)
pointing at a previous-version commit, and the GitHub release had to be
manually re-pointed to the real vX.Y.Z tag after each release.

- create_release now attaches the release to inputs.release_tag for
  stable releases; pre-releases keep their computed tag (e.g.
  1.10.0rc1) but it is minted at the release commit via 'commit:'.
- release-lfx.yml pins the minted lfx-v* tag to github.sha instead of
  the default branch.

The validate-tag-format guard (#12847) only blocks at dispatch time;
create_release was re-creating the very duplicates it guards against.
This commit is contained in:
Eric Hare
2026-06-10 08:41:00 -07:00
committed by GitHub
parent 1cf2bb4c16
commit fb1edd99fd
2 changed files with 20 additions and 1 deletions

View File

@ -337,6 +337,9 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: lfx-v${{ github.event.inputs.version }}
# Pin the minted tag to the commit this release was built from;
# without it GitHub creates the tag at the default-branch HEAD.
target_commitish: ${{ github.sha }}
name: LFX ${{ github.event.inputs.version }}
body_path: release_notes.md
draft: false

View File

@ -1216,6 +1216,20 @@ jobs:
with:
name: dist-main
path: dist
# The release must attach to the dispatched v-prefixed tag. Passing the
# bare version as `tag` made GitHub mint a new lightweight tag at the
# default-branch HEAD — the wrong commit, still carrying the previous
# version (main only adopts the new version via the post-release
# back-merge). Pre-releases keep their computed tag (e.g. 1.10.0rc1),
# but `commit` pins any newly minted tag to the release commit.
- name: Resolve release commit
id: release_commit
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sha=$(gh api "repos/${{ github.repository }}/commits/${{ inputs.release_tag }}" --jq '.sha')
echo "Release tag '${{ inputs.release_tag }}' resolves to commit $sha"
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: Create Release
uses: ncipollo/release-action@v1
with:
@ -1224,6 +1238,8 @@ jobs:
draft: false
generateReleaseNotes: true
prerelease: ${{ inputs.pre_release }}
tag: ${{ needs.determine-main-version.outputs.version }}
tag: ${{ inputs.pre_release && needs.determine-main-version.outputs.version || inputs.release_tag }}
name: ${{ needs.determine-main-version.outputs.version }}
commit: ${{ steps.release_commit.outputs.sha }}
allowUpdates: true
updateOnlyUnreleased: false