1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2024-11-28 08:20:51 +01:00
bemanitools/scripts/ci/create-release-message.sh
icex2 729f5abcc0 Output to stderr instead of stdout in release message script
stdout is used for actual data output which is captured by
the ci pipeline. stderr shows up properly in debug output
2021-12-28 23:40:21 +01:00

28 lines
585 B
Bash
Executable File

#!/bin/sh
VERSION="$1"
section_active=""
changelog_excerpt=""
while IFS= read -r line; do
if [ "$section_active" ]; then
if [[ "$(echo "$line" | grep '^#')" ]]; then
section_active=""
else
changelog_excerpt="$(printf "%s\n%s" "$changelog_excerpt" "$line")"
fi
else
if [ "$line" = "## $VERSION" ]; then
section_active="1"
fi
fi
done
if [ "$changelog_excerpt" ]; then
printf "%s" "$changelog_excerpt"
exit 0
else
>&2 echo "Could not find version in changelog: $VERSION"
exit 1
fi