diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8af13817..4975cdc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,11 +104,7 @@ jobs: - name: Extract ChangeLog entry ... run: | - awk '/^-----*$/{if (x == 1) exit; x=1;next}x' doc/ChangeLog.md \ - |head -n -1 > release.md - echo "" >> release.md - echo "> [!TIP]" >> release.md - echo "> **Try Infix in GNS3!** Download the appliance from the [GNS3 Marketplace](https://gns3.com/marketplace/appliances/infix) to test Infix in a virtual network environment without hardware." >> release.md + cat doc/ChangeLog.md | ./utils/extract-changelog.sh > release.md cat release.md - uses: ncipollo/release-action@v1 diff --git a/utils/extract-changelog.sh b/utils/extract-changelog.sh new file mode 100755 index 00000000..ad92f6e4 --- /dev/null +++ b/utils/extract-changelog.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Extract the latest release entry from ChangeLog.md and unwrap lines +# for GitHub's web view (lets the browser handle line wrapping). +# +# Usage: cat doc/ChangeLog.md | extract-changelog.sh > release.md +# +# Output goes to stdout. +# + +set -e -o pipefail + +# Extract section between first two --- lines, skip trailing blank lines +head -n -1 < <(awk '/^-----*$/{if (x == 1) exit; x=1;next}x') | + +# Unwrap lines for GitHub's web view (browser does wrapping) +# Preserves: blank lines, list items, headings, blockquotes, indented blocks +# Joins: soft-wrapped paragraph/list continuations +awk ' +{ + if (/^$/) { + if (buf) print buf + buf = "" + print + blank = 1 + next + } + if (/^ / && buf) { + # Indented continuation - strip indent and join + sub(/^ /, " ") + buf = buf $0 + } else if (/^[-*>#\[|]/ || /^[0-9]+\./ || blank || !buf || brk) { + # New block: special char, after blank, first line, or after md break + if (buf) print buf + buf = $0 + } else { + # Paragraph continuation - join with space + buf = buf " " $0 + } + blank = 0 + brk = / $/ +} +END { if (buf) print buf } +' + +# Append tip for GNS3 +cat < [!TIP] +> **Try Infix in GNS3!** Download the appliance from the [GNS3 Marketplace](https://gns3.com/marketplace/appliances/infix) to test Infix in a virtual network environment without hardware. +EOF