Update version bump check so it works on master branch (#26146)

This commit is contained in:
Will Hickey 2022-06-22 15:26:10 -05:00 committed by GitHub
parent c5c2b44ecc
commit 4cfcfe51a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ usage() {
cat <<EOF
usage: $0 branch tag
Checks that the tag matches the branch and the Cargo.toml versions match the tag.
Checks that the tag matches the branch (unless branch is master) and the Cargo.toml versions match the tag.
EOF
exit 0
}
@ -13,13 +13,14 @@ EOF
branch="$1"
tag="$2"
[[ -n $tag ]] || usage
echo "branch: $branch tag: $tag"
# The tag is expected to be the branch name plus a patch number. eg:
# The tag is expected to be the branch name plus a patch number (unless branch is master). eg:
# tag: v1.2.3
# branch: v1.2
if [[ "$tag" != "$branch"* ]]; then
>&2 echo "Tag must start with the branch name. Tag: $tag Branch: $branch"
if [[ "$tag" != "$branch"* && $branch != "master" ]]; then
>&2 echo "Tag must start with the branch name (unless branch is master). Tag: $tag Branch: $branch"
exit 1
fi