mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 03:40:30 +00:00
create_release.sh: use ATX markdown hdr instead of bold for changes and fixes
This allows having some formatting in FIXES.md, eg. for different minor
versions like that:
#### 1.7.1
- changes for 1.7.1
- another fix in 1.7.1
### 1.7.2
- fixes for 1.7.2
+ join the lines like beginning with spaces more inteligently
This commit is contained in:
19
.github/scripts/create_release.sh
vendored
19
.github/scripts/create_release.sh
vendored
@@ -1,5 +1,11 @@
|
||||
#!/bin/sh -eu
|
||||
|
||||
# Joins line that starts with space to previous:
|
||||
# https://www.gnu.org/software/sed/manual/html_node/Joining-lines.html
|
||||
MERG_LN=':a ; $!N ; s/\n\s+/ / ; ta ; P ; D'
|
||||
# https://unix.stackexchange.com/questions/114943/can-sed-replace-new-line-characters
|
||||
REPL_NL=':a;N;$!ba;s/\n/\\n/g'
|
||||
|
||||
sudo apt install jq
|
||||
URL=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -X GET https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$TAG | jq -r '.url')
|
||||
REQ=PATCH
|
||||
@@ -16,9 +22,17 @@ else
|
||||
TITLE="UltraGrid $VERSION"
|
||||
FIXES=
|
||||
if [ -f FIXES.md ]; then
|
||||
FIXES="**Fixes since last release:**$(cat FIXES.md | sed -e 's/^\*/\\n*/' | tr '\n' ' ')\n\n"
|
||||
TMP=$(mktemp)
|
||||
sed -E "$MERG_LN" < FIXES.md | sed -e "$REPL_NL" > "$TMP"
|
||||
F=$(cat "$TMP")
|
||||
FIXES="### Fixes since last release:\n$F\n"
|
||||
rm "$TMP"
|
||||
fi
|
||||
SUMMARY="**Changes:**$(cat NEWS | sed -e '1,2d' -e '/^$/q' -e 's/^\*/\\n*/' | tr '\n' ' ')\n\n$FIXES**Full changelog:** https://github.com/$GITHUB_REPOSITORY/commits/$TAG"
|
||||
TMP=$(mktemp)
|
||||
sed -e '1,2d' -e '/^$/q' < NEWS | sed -E "$MERG_LN" | sed -e "$REPL_NL" > "$TMP"
|
||||
N=$(cat "$TMP")
|
||||
SUMMARY="### Changes:\n$N\n$FIXES\n**Full changelog:** https://github.com/$GITHUB_REPOSITORY/commits/$TAG"
|
||||
rm "$TMP"
|
||||
PRERELEASE=false
|
||||
fi
|
||||
|
||||
@@ -28,3 +42,4 @@ curl -S -H "Authorization: token $GITHUB_TOKEN" -X $REQ $URL -T - <<EOF
|
||||
"body": "Built $DATE\n\n$SUMMARY",
|
||||
"draft": false, "prerelease": $PRERELEASE
|
||||
}
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user