Skip to content

Commit

Permalink
MISC: mknews.sh: for release tags, copy news section from NEWS.md
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Sep 6, 2023
1 parent e4007d4 commit 9dfb091
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions misc/mknews.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,30 @@ fetch_news_version() # fetch_news_version {1|2}
}

# Produce assets/NEWS.md
CURRENT_VERSION=$("${ABSPATHSCRIPT%/*}"/version.sh | (read v h d && echo $v))
NEWS_TAG="v$(fetch_news_version 1)"

echo "## Anklang $CURRENT_VERSION"
echo
echo 'Development version - may contain bugs or compatibility issues.'
echo
echo '``````````````````````````````````````````````````````````````````````````````````````'
git log --pretty='%s # %cd %an %h%n%w(0,4,4)%b' \
--reverse \
--first-parent --date=short "$NEWS_TAG..HEAD" |
sed -e '/^\s*Signed-off-by:.*<.*@.*>/d' |
sed '/^\s*$/{ N; /^\s*\n\s*$/D }'
echo '``````````````````````````````````````````````````````````````````````````````````````'
echo
# When generating news for release tags...
if RELEASETAG=$(git describe --match='v[0-9]*.[0-9]*.[0-9]*' --exact-match 2>/dev/null) ; then
# Copy release version news section from NEWS.md
SEDSEC1="
0,/^##?\s/n; # Read ahead until first heading
/^##?\s/Q; # Quit processing before printing second heading
"
sed -re "$SEDSEC1" < NEWS.md |
sed -z 's/\n\+$/\n/' # Strip newlines at EOF
else
# Generate pre-release news from git history
CURRENT_VERSION=$("${ABSPATHSCRIPT%/*}"/version.sh | (read v h d && echo $v))
NEWS_TAG="v$(fetch_news_version 1)"
echo "## Anklang $CURRENT_VERSION"
echo
echo 'Development version - may contain bugs or compatibility issues.'
echo
echo '``````````````````````````````````````````````````````````````````````````````````````'
git log --pretty='%s # %cd %an %h%n%w(0,4,4)%b' \
--reverse \
--first-parent --date=short "$NEWS_TAG..HEAD" |
sed -e '/^\s*Signed-off-by:.*<.*@.*>/d' |
sed '/^\s*$/{ N; /^\s*\n\s*$/D }'
echo '``````````````````````````````````````````````````````````````````````````````````````'
echo
fi

0 comments on commit 9dfb091

Please sign in to comment.