diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13eaefeb..0618db3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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.. 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)" + + if [ -n "$previous_tag" ]; then + commit_range="${previous_tag}..${RELEASE_COMMIT}" + 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: