Skip to content

Commit

Permalink
scripts/release: error when version cannot be parsed (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe committed Feb 20, 2023
1 parent fe344c8 commit e33a503
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ function init {
fi

TARGET_VERSION="$(getTargetVersion)"

if [ "$TARGET_VERSION" = "" ] ; then
printf "Target version not found in changelog, exiting\n"
exit 1
fi
}

semverRegex='\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(-\?\)\([0-9a-zA-Z.]\+\)\?'

function getTargetVersion {
# parse target version from CHANGELOG
sed -n 's/^# '"$semverRegex"' (Unreleased)$/\1\2\3/p' CHANGELOG.md || \
(printf "\nTarget version not found in changelog, exiting" && \
exit 1)
sed -n 's/^# '"$semverRegex"' (Unreleased)$/\1\2\3/p' CHANGELOG.md
}

function modifyChangelog {
Expand Down

0 comments on commit e33a503

Please sign in to comment.