Skip to content

Commit f1d2971

Browse files
authored
fix(ci): create GitHub releases on the dispatched v-prefixed tag (#13608)
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.
1 parent fedec98 commit f1d2971

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/release-lfx.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ jobs:
337337
uses: softprops/action-gh-release@v2
338338
with:
339339
tag_name: lfx-v${{ github.event.inputs.version }}
340+
# Pin the minted tag to the commit this release was built from;
341+
# without it GitHub creates the tag at the default-branch HEAD.
342+
target_commitish: ${{ github.sha }}
340343
name: LFX ${{ github.event.inputs.version }}
341344
body_path: release_notes.md
342345
draft: false

.github/workflows/release.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,20 @@ jobs:
12161216
with:
12171217
name: dist-main
12181218
path: dist
1219+
# The release must attach to the dispatched v-prefixed tag. Passing the
1220+
# bare version as `tag` made GitHub mint a new lightweight tag at the
1221+
# default-branch HEAD — the wrong commit, still carrying the previous
1222+
# version (main only adopts the new version via the post-release
1223+
# back-merge). Pre-releases keep their computed tag (e.g. 1.10.0rc1),
1224+
# but `commit` pins any newly minted tag to the release commit.
1225+
- name: Resolve release commit
1226+
id: release_commit
1227+
env:
1228+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1229+
run: |
1230+
sha=$(gh api "repos/${{ github.repository }}/commits/${{ inputs.release_tag }}" --jq '.sha')
1231+
echo "Release tag '${{ inputs.release_tag }}' resolves to commit $sha"
1232+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
12191233
- name: Create Release
12201234
uses: ncipollo/release-action@v1
12211235
with:
@@ -1224,6 +1238,8 @@ jobs:
12241238
draft: false
12251239
generateReleaseNotes: true
12261240
prerelease: ${{ inputs.pre_release }}
1227-
tag: ${{ needs.determine-main-version.outputs.version }}
1241+
tag: ${{ inputs.pre_release && needs.determine-main-version.outputs.version || inputs.release_tag }}
1242+
name: ${{ needs.determine-main-version.outputs.version }}
1243+
commit: ${{ steps.release_commit.outputs.sha }}
12281244
allowUpdates: true
12291245
updateOnlyUnreleased: false

0 commit comments

Comments
 (0)