Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ jobs:
with:
persist-credentials: false
submodules: recursive
fetch-depth: 0
fetch-tags: true

- name: Download GitHub artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand All @@ -405,10 +407,42 @@ jobs:
ANNOUNCEMENT_TITLE: "${{ fromJson(needs.host.outputs.val).announcement_title }}"
ANNOUNCEMENT_BODY: "${{ fromJson(needs.host.outputs.val).announcement_github_body }}"
RELEASE_COMMIT: "${{ github.sha }}"
RELEASE_TAG: "${{ needs.plan.outputs.tag }}"
REPO: "${{ github.repository }}"
shell: bash
run: |
set -euo pipefail

echo "$ANNOUNCEMENT_BODY" > "$RUNNER_TEMP/notes.txt"
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*

# Append the commits included in this release (previous stable tag -> this release).
# Find the most recent stable v<major>.<minor>.<patch> tag that isn't the one being
# released; canary-* and other non-release tags are ignored by the glob.
previous_tag="$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-version:refname \
| grep -vFx "$RELEASE_TAG" | head -n1 || true)"
Comment on lines +421 to +422

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Select a previous tag from the release ancestry

When manually publishing or recreating an older/backport release after a higher stable version exists, sorting every tag by version and merely excluding the current tag selects that newer release as previous_tag. The resulting newer..older log is empty or contains only divergent commits, and the changelog link compares unrelated releases; restrict candidates to tags merged into the release commit and select the nearest preceding one.

Useful? React with 👍 / 👎.


if [ -n "$previous_tag" ]; then
commit_range="${previous_tag}..${RELEASE_COMMIT}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge End the commit range at the released tag

When this workflow is manually dispatched from a branch while inputs.tag identifies a different commit, the plan checks out that tag but RELEASE_COMMIT remains the dispatch ref's github.sha. This range therefore lists commits through the branch tip rather than commits contained in the release, while the notes and comparison link label them as belonging to RELEASE_TAG; resolve the endpoint from the tag or propagate the plan checkout SHA.

Useful? React with 👍 / 👎.

range_heading="$previous_tag...$RELEASE_TAG"
else
# First release: include the whole history up to this commit.
commit_range="$RELEASE_COMMIT"
range_heading="$RELEASE_TAG"
fi

commits="$(git log --no-merges --pretty=format:'- %s (%h)' "$commit_range" || true)"
if [ -n "$commits" ]; then
{
printf '\n## Commits\n\n'
printf '%s\n' "$commits"
if [ -n "$previous_tag" ]; then
printf '\n**Full Changelog**: https://github.com/%s/compare/%s...%s\n' \
"$REPO" "$previous_tag" "$RELEASE_TAG"
fi
} >> "$RUNNER_TEMP/notes.txt"
fi

gh release create "$RELEASE_TAG" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*

smoke-install-unix:
needs:
Expand Down
Loading