Skip to content

Commit 0203c2f

Browse files
committed
fix(ci): use --notes-start-tag to anchor auto-notes to the SemVer previous
The fork's v1.4.0 release was re-published after v1.5.0, which made --generate-notes pick v1.4.0 as the previous for any v1.5.x release. Explicitly pass the SemVer previous (e.g. v1.5.0 for v1.5.1-rc.N or v1.5.1) as --notes-start-tag so the auto-notes show the real v1.5.0..v1.5.1 diff.
1 parent 996524d commit 0203c2f

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,27 @@ jobs:
308308
IS_PRERELEASE="false"
309309
fi
310310
311+
# Compute the previous stable tag for auto-generated release notes. We don't use
312+
# GitHub's "most recent prior release by date" because the fork carries re-published
313+
# upstream releases whose published_at is more recent than the fork's own first release.
314+
# For SemVer X.Y.Z: previous is vX.Y.(Z-1) if Z>0, else vX.(Y-1).0, else v(X-1).0.0.
315+
STABLE_VERSION="${VERSION%%-*}"
316+
IFS='.' read -r PX PY PZ <<< "$STABLE_VERSION"
317+
if (( PZ > 0 )); then
318+
NOTES_START_TAG="v${PX}.${PY}.$((PZ - 1))"
319+
elif (( PY > 0 )); then
320+
NOTES_START_TAG="v${PX}.$((PY - 1)).0"
321+
else
322+
NOTES_START_TAG="v$((PX - 1)).0.0"
323+
fi
324+
echo "Computed notes_start_tag=${NOTES_START_TAG} for tag=${TAG}"
325+
311326
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
312327
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
313328
echo "stable_version=$STABLE_VERSION" >> "$GITHUB_OUTPUT"
314329
echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"
315330
echo "prerelease_flag=$PRERELEASE_FLAG" >> "$GITHUB_OUTPUT"
331+
echo "notes_start_tag=$NOTES_START_TAG" >> "$GITHUB_OUTPUT"
316332
317333
- name: Download Windows installer
318334
uses: actions/download-artifact@v4
@@ -345,6 +361,7 @@ jobs:
345361
GH_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
346362
TAG: ${{ steps.release.outputs.tag }}
347363
PRERELEASE_FLAG: ${{ steps.release.outputs.prerelease_flag }}
364+
NOTES_START_TAG: ${{ steps.release.outputs.notes_start_tag }}
348365
run: |
349366
mapfile -t FILES < <(find artifacts -type f | sort)
350367
if [[ "${#FILES[@]}" -eq 0 ]]; then
@@ -355,11 +372,17 @@ jobs:
355372
if gh release view "$TAG" >/dev/null 2>&1; then
356373
gh release upload "$TAG" "${FILES[@]}" --clobber
357374
else
375+
# --notes-start-tag controls which previous tag GitHub compares against
376+
# when auto-generating the release notes. Default behaviour (most recent
377+
# prior release by date) doesn't work for this fork because the v1.4.0
378+
# release in the fork was re-published after v1.5.0, which makes GitHub
379+
# pick v1.4.0 as the "previous" for any v1.5.x release.
358380
# shellcheck disable=SC2086
359381
gh release create "$TAG" "${FILES[@]}" \
360382
--target "$GITHUB_SHA" \
361383
--title "$TAG" \
362384
--generate-notes \
385+
--notes-start-tag "$NOTES_START_TAG" \
363386
$PRERELEASE_FLAG
364387
fi
365388

0 commit comments

Comments
 (0)