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

View File

@ -1,5 +1,15 @@
# Changes # 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 ## edge-24.2.4
* Updated the ExternalWorkload CRD to v1beta1, renaming the meshTls field to * 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"
}