diff --git a/.github/changelog-processor.py b/.github/changelog-processor.py index b005c620d8..10750aade7 100755 --- a/.github/changelog-processor.py +++ b/.github/changelog-processor.py @@ -26,21 +26,38 @@ help="Should a release be made? Prints `1` or `0`.", action="store_true" ) +group.add_argument( + "--print-changelog-from-last-release", + dest="changelog_last_release", + help="Print the changelog from the last release.", + action="store_true" +) args = parser.parse_args() with open(args.changelog, "r") as changelog: lines = changelog.readlines() + changelog_last_release = "" + found_last_version = False + # Find the latest version for line in lines: if not line.startswith("## ["): + changelog_last_release += line continue + elif not found_last_version: + changelog_last_release += line + found_last_version = True + version = line.strip().removeprefix("## [").split("]")[0] + else: + break - version = line.strip().removeprefix("## [").split("]")[0] - break - if args.print_latest_version: + if args.changelog_last_release: + print(changelog_last_release, end = "") + sys.exit(0) + elif args.print_latest_version: print(version, end = "") sys.exit(0) elif args.should_release: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d19cbe550c..aa5dc01b45 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -105,12 +105,21 @@ jobs: CONTEXT=$(find . -name '*_srtool_output.json') SRTOOL() { <$(<<<$CONTEXT head -n1) jq -r .$1; } WASM() { <${JSON} jq -r ".runtimes.compressed.subwasm.$1"; } + + # Copy the relevant parts of the changelog + .github/changelog-processor.py CHANGELOG.md --print-changelog-from-last-release > DRAFT + tee -a DRAFT <<-EOF - EOF - tee -a DRAFT