Jelajahi Sumber

Update the release scripts to include the breaking changes section

Benoit Blanchon 1 tahun lalu
induk
melakukan
254fa5712a

+ 7 - 1
.github/workflows/release.yml

@@ -21,7 +21,13 @@ jobs:
         id: body
         run: |
           FILENAME=RELEASE.md
-          extras/scripts/get-release-body.sh ${{ steps.init.outputs.tag }} CHANGELOG.md | tee $FILENAME
+          tee $FILENAME <<END
+          ## Changes
+
+          $(extras/scripts/extract_changes.awk CHANGELOG.md)
+
+          [View version history](https://github.com/bblanchon/ArduinoJson/blob/${{ steps.init.outputs.tag }}/CHANGELOG.md)
+          END
           echo "filename=$FILENAME" >> $GITHUB_OUTPUT
       - name: Amalgamate ArduinoJson.h
         id: amalgamate_h

+ 29 - 0
extras/scripts/extract_changes.awk

@@ -0,0 +1,29 @@
+#!/usr/bin/awk -f
+
+# Start echoing after the first list item
+/\* / {
+    STARTED=1
+    EMPTY_LINE=0
+}
+
+# Remember if we have seen an empty line
+/^[[:space:]]*$/ {
+    EMPTY_LINE=1
+}
+
+# Exit when seeing a new version number
+/^v[[:digit:]]/ {
+    if (STARTED) exit
+}
+
+# Print if the line is not empty
+# and restore the empty line we have skipped
+!/^[[:space:]]*$/ {
+    if (STARTED) {
+        if (EMPTY_LINE) {
+            print ""
+            EMPTY_LINE=0
+        }
+        print
+    }
+}

+ 0 - 14
extras/scripts/get-release-body.sh

@@ -1,14 +0,0 @@
-#!/bin/bash
-
-set -eu
-
-TAG="$1"
-CHANGELOG="$2"
-
-cat << END
-## Changes
-
-$(awk '/\* /{ FOUND=1 } /^[[:space:]]*$/ { if(FOUND) exit } { if(FOUND) print }' "$CHANGELOG")
-
-[View version history](https://github.com/bblanchon/ArduinoJson/blob/$TAG/CHANGELOG.md)
-END

+ 1 - 1
extras/scripts/get-release-page.sh

@@ -14,5 +14,5 @@ date: '$(date +'%Y-%m-%d')'
 $(extras/scripts/wandbox/publish.sh "$ARDUINOJSON_H")
 ---
 
-$(awk '/\* /{ FOUND=1; print; next } { if (FOUND) exit}' "$CHANGELOG")
+$(extras/scripts/extract_changes.awk "$CHANGELOG")
 END