ci: Update release workflow to generate release notes (#12132)

GitHub can automatically generate release notes from commit messages. This saves
us from having to manually update the `CHANGES.md` file every week.

In preparation for the next edge release, this change updates the release
workflow to stop relying on the CHANGES file. The CHANGES file is updated with a
pointer to the releases page.
This commit is contained in:
Oliver Gould 2024-02-22 11:31:05 -08:00 committed by GitHub
parent 8bad553a30
commit 02e982cc5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 47 deletions

View File

@ -221,7 +221,8 @@ jobs:
needs:
- tag
- integration_tests
- choco_pack
# TODO(ver) choco packages are not produced for edge releases...
# - choco_pack
if: startsWith(github.ref, 'refs/tags/stable') || startsWith(github.ref, 'refs/tags/edge')
timeout-minutes: 30
runs-on: ubuntu-20.04
@ -229,31 +230,24 @@ jobs:
contents: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set environment variables
run: |
echo 'TAG=${{ needs.tag.outputs.tag }}' >> "$GITHUB_ENV"
. bin/_release.sh
extract_release_notes NOTES.md
- name: Download choco package
if: startsWith(github.ref, 'refs/tags/stable')
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe
with:
name: choco
path: choco
# - name: Download choco package
# if: startsWith(github.ref, 'refs/tags/stable')
# uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe
# with:
# name: choco
# path: choco
- name: Pull CLI binaries
env:
DOCKER_TARGET: multi-arch
run : |
bin/docker-pull-binaries "$TAG"
v=${TAG#"stable-"}
mv choco/linkerd.*.nupkg "target/release/linkerd2-cli-stable-$v.nupkg" || true
run: DOCKER_TARGET=multi-arch bin/docker-pull-binaries '${{ needs.tag.outputs.tag }}'
# v=${TAG#"stable-"}
# mv choco/linkerd.*.nupkg "target/release/linkerd2-cli-stable-$v.nupkg" || true
- name: Create release
id: create_release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
name: '${{ needs.tag.outputs.tag }}'
generate_release_notes: true
draft: false
prerelease: false
body_path: NOTES.md
files: |
./target/release/linkerd2-cli-*-darwin*
./target/release/linkerd2-cli-*-linux-*

View File

@ -1,5 +1,15 @@
# Changes
Please visit Linkerd's [Release page][gh-releases] for for the latest release
notes moving forward!
[gh-releases]: https://github.com/linkerd/linkerd2/releases
## edge-24.2.5
* Migrated edge release change notes to use GitHub's automated release notes
feature.
## edge-24.2.4
* Updated the ExternalWorkload CRD to v1beta1, renaming the meshTls field to

View File

@ -1,28 +0,0 @@
#!/usr/bin/env bash
# shellcheck disable=SC2120
# (disabling SC2120 so that we can use functions with optional args
# see https://github.com/koalaman/shellcheck/wiki/SC2120#exceptions )
set -eu
extract_release_notes() {
bindir=$( cd "${BASH_SOURCE[0]%/*}" && pwd )
rootdir=$( cd "$bindir"/.. && pwd )
if [ $# -eq 0 ]
then
# Make temporary file to save the release commit message into.
tmp=$(mktemp -t release-commit-message.XXX.txt)
else
tmp="$rootdir/$1"
fi
# Save commit message into temporary file.
#
# Match each occurrence of the regex and increment `n` by 1. While n == 1
# (which is true only for the first section) print that line of `CHANGES.md`.
# This ends up being the first section of release changes.
awk '/^## (edge|stable)-[0-9]+\.[0-9]+\.[0-9]+/{n++} n==1' "$rootdir"/CHANGES.md > "$tmp"
echo "$tmp"
}