Ivan Schaller
9d127581ef
All checks were successful
ci/woodpecker/push/tests Pipeline was successful
46 lines
929 B
Bash
Executable file
46 lines
929 B
Bash
Executable file
#!/bin/bash
|
|
# shellcheck disable=SC2016
|
|
|
|
# script to extract the release notes from the changelog
|
|
|
|
# show script help
|
|
function show_help() {
|
|
cat << EOF
|
|
|
|
Script to generate release-notes from a changelog (CHANGELOG.md)
|
|
Usage:
|
|
./get_release_notes.sh <new_version>
|
|
|
|
|
|
Example:
|
|
./get_release_notes.sh "2.0.5"
|
|
|
|
EOF
|
|
exit 0
|
|
}
|
|
|
|
# create changelog for release
|
|
function get_release_notes() {
|
|
local l_version
|
|
|
|
printf 'Creating release-notes\n'
|
|
# check for version
|
|
if [[ -z "${l_version}" ]]; then
|
|
printf 'You need to specify a version with $1\n'
|
|
exit 1
|
|
fi
|
|
awk -v ver="[${l_version}]" \
|
|
'/^## / { if (p) { exit }; if ($2 == ver) { p=1 } } p && NF' \
|
|
'CHANGELOG.md' > 'RELEASENOTES.md'
|
|
printf 'Done\n'
|
|
}
|
|
|
|
# check options
|
|
case "${1}" in
|
|
'--help' | '-h' | 'help')
|
|
show_help
|
|
;;
|
|
*)
|
|
get_release_notes "${@}"
|
|
;;
|
|
esac
|