mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
Automatically generate release notes draft during proposal
This commit is contained in:
parent
3c5d7822c5
commit
25ef7a1956
2 changed files with 65 additions and 0 deletions
63
.github/release-notes.sh
vendored
Executable file
63
.github/release-notes.sh
vendored
Executable file
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
scratch=$(mktemp -d -t tmp.XXXXXXXXXX)
|
||||||
|
finish() {
|
||||||
|
rm -rf "$scratch"
|
||||||
|
}
|
||||||
|
trap finish EXIT
|
||||||
|
|
||||||
|
DATE=$(date +%Y-%m-%d)
|
||||||
|
DETERMINATE_NIX_VERSION=$(cat .version-determinate)
|
||||||
|
TAG_NAME="v${DETERMINATE_NIX_VERSION}"
|
||||||
|
NIX_VERSION=$(cat .version)
|
||||||
|
NIX_VERSION_MAJOR_MINOR=$(echo "$NIX_VERSION" | cut -d. -f1,2)
|
||||||
|
GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-DeterminateSystems/nix-src}"
|
||||||
|
|
||||||
|
gh api "/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
|
||||||
|
-f "tag_name=${TAG_NAME}" > "$scratch/notes.json"
|
||||||
|
|
||||||
|
trim_trailing_newlines() {
|
||||||
|
tac \
|
||||||
|
| awk 'flag {print} {if(NF) flag=1}' \
|
||||||
|
| tac
|
||||||
|
}
|
||||||
|
|
||||||
|
linkify_gh() {
|
||||||
|
sed \
|
||||||
|
-e 's#\(https://github.com/DeterminateSystems/nix-src/\(pull\|issue\)/\([[:digit:]]\+\)\)#[dnix\#\3](\1)#' \
|
||||||
|
-e 's#\(https://github.com/DeterminateSystems/nix-src/compare/\([^ ]\+\)\)#[\2](\1)#'
|
||||||
|
}
|
||||||
|
|
||||||
|
(
|
||||||
|
cat doc/manual/source/release-notes-determinate/changes.md \
|
||||||
|
| sed 's/^.*\(<!-- differences -->\)$/This section lists the differences between upstream Nix '"$NIX_VERSION_MAJOR_MINOR"' and Determinate Nix '"$DETERMINATE_NIX_VERSION"'.\1/' \
|
||||||
|
|
||||||
|
printf "\n<!-- Determinate Nix version %s -->\n" "$DETERMINATE_NIX_VERSION"
|
||||||
|
cat "$scratch/notes.json" \
|
||||||
|
| jq -r .body \
|
||||||
|
| grep -v '^#' \
|
||||||
|
| grep -v "Full Changelog" \
|
||||||
|
| trim_trailing_newlines \
|
||||||
|
| sed -e 's/^\* /\n* /' \
|
||||||
|
| linkify_gh
|
||||||
|
) > "$scratch/changes.md"
|
||||||
|
|
||||||
|
(
|
||||||
|
printf "# Release %s (%s)\n\n" \
|
||||||
|
"$DETERMINATE_NIX_VERSION" \
|
||||||
|
"$DATE"
|
||||||
|
printf "* Based on [upstream Nix %s](../release-notes/rl-%s.md).\n\n" \
|
||||||
|
"$NIX_VERSION" \
|
||||||
|
"$NIX_VERSION_MAJOR_MINOR"
|
||||||
|
|
||||||
|
cat "$scratch/notes.json" | jq -r .body | linkify_gh
|
||||||
|
) > "$scratch/rl.md"
|
||||||
|
|
||||||
|
(
|
||||||
|
cat doc/manual/source/SUMMARY.md.in \
|
||||||
|
| sed 's/\(<!-- next -->\)$/\1\n - [Release '"$DETERMINATE_NIX_VERSION"' ('"$DATE"')](release-notes-determinate\/rl-'"$DETERMINATE_NIX_VERSION"'.md)/'
|
||||||
|
) > "$scratch/summary.md"
|
||||||
|
|
||||||
|
mv "$scratch/changes.md" doc/manual/source/release-notes-determinate/changes.md
|
||||||
|
mv "$scratch/rl.md" "doc/manual/source/release-notes-determinate/rl-${DETERMINATE_NIX_VERSION}.md"
|
||||||
|
mv "$scratch/summary.md" doc/manual/source/SUMMARY.md.in
|
2
.github/workflows/propose-release.yml
vendored
2
.github/workflows/propose-release.yml
vendored
|
@ -26,4 +26,6 @@ jobs:
|
||||||
extra-commands-early: |
|
extra-commands-early: |
|
||||||
echo ${{ inputs.version }} > .version-determinate
|
echo ${{ inputs.version }} > .version-determinate
|
||||||
git add .version-determinate
|
git add .version-determinate
|
||||||
|
./.github/release-notes.sh
|
||||||
|
git add doc
|
||||||
git commit -m "Set .version-determinate to ${{ inputs.version }}" || true
|
git commit -m "Set .version-determinate to ${{ inputs.version }}" || true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue