Skip to content

Commit

Permalink
fix calculate_version script
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrotkk committed Sep 24, 2019
1 parent 389c245 commit 0b73082
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/calculate_version.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0b73082

Please sign in to comment.