From 0b730829d071fb19b9dd97c49b0f8c98619f913c Mon Sep 17 00:00:00 2001 From: Dmytro Tkachuk Date: Tue, 24 Sep 2019 13:02:30 +0300 Subject: [PATCH] fix calculate_version script --- scripts/calculate_version.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/calculate_version.sh b/scripts/calculate_version.sh index c66b7abf..eb58ea15 100644 --- a/scripts/calculate_version.sh +++ b/scripts/calculate_version.sh @@ -1,5 +1,13 @@ #!/usr/bin/env bash VERSION=$(python setup.py --version) +USAGE_MSG='Usage: BRANCH=[BRANCH] calculate_version.sh' + +if [ -z "$BRANCH" ] +then + (>&2 echo 'You should provide branch') + echo $USAGE_MSG + exit 1 +fi if [ -z $VERSION ]; then @@ -12,12 +20,12 @@ if [[ $BRANCH == 'stable' ]]; then exit 1 fi -git fetch --tags +git fetch --tags > /dev/null for (( NUMBER=0; ; NUMBER++ )) do FULL_VERSION="$VERSION-$BRANCH.$NUMBER" - if ! [ $(git tag -l ?$FULL_VERSION) ]; then + if ! [ $(git tag -l | grep $FULL_VERSION) ]; then echo "$FULL_VERSION" | tr / - break fi