diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52750e13..2d7fdb20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -286,10 +286,14 @@ jobs: - name: Make source archive run: | ./contrib/release/make-archive.sh artifacts + - name: Latest Changes + run: | + ./contrib/release/latest-changelog.awk CHANGELOG.md >latest-changes.md - name: Draft Release uses: softprops/action-gh-release@v1 with: draft: true + body_path: latest-changes.md fail_on_unmatched_files: true files: | artifacts/stgit-*.tar.gz diff --git a/contrib/release/latest-changelog.awk b/contrib/release/latest-changelog.awk new file mode 100755 index 00000000..2a4301c0 --- /dev/null +++ b/contrib/release/latest-changelog.awk @@ -0,0 +1,30 @@ +#!/usr/bin/env -S awk -f + +# Extract the latest release notes from CHANGELOG.md. +# +# The h3 sections from the first h2 section are printed. + +BEGIN { + foundFirstH2 = 0 + foundFirstH3 = 0 + foundSecondH2 = 0 +} + +{ + if (!foundFirstH2) { + if ($0 ~ /^## /) { + foundFirstH2 = 1 + } + } else if (!foundFirstH3) { + if ($0 ~ /^### /) { + foundFirstH3 = 1 + print $0 + } + } else if (!foundSecondH2) { + if ($0 ~ /^## /) { + foundSecondH2 = 1 + } else { + print $0 + } + } +}