Skip to content

Commit

Permalink
ci: add latest-changelog.awk
Browse files Browse the repository at this point in the history
  • Loading branch information
jpgrayson committed Dec 11, 2023
1 parent 72b5b10 commit f0a6a28
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions contrib/release/latest-changelog.awk
Original file line number Diff line number Diff line change
@@ -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
}
}
}

0 comments on commit f0a6a28

Please sign in to comment.