Skip to content

Commit

Permalink
build: validate the version number (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Apr 27, 2021
1 parent 77ecdb5 commit cb62f99
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ set -o xtrace

if [ $# -ne 1 ]; then
echo "Usage: ./release.sh version" >&2
exit 1;
exit 1
fi

# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
if [[ ! $1 =~ ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ ]]; then
echo "Invalid version number: $1" >&2
exit 1
fi

git checkout main
Expand Down

0 comments on commit cb62f99

Please sign in to comment.