Skip to content

Commit

Permalink
save version without tag prefix into version file
Browse files Browse the repository at this point in the history
  • Loading branch information
andgineer committed Aug 11, 2021
1 parent 56e3bf7 commit 09e2a2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions verup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ major=0
minor=0
build=0

regex="([0-9]+).([0-9]+).([0-9]+)"
regex="v\.([0-9]+)\.([0-9]+)\.([0-9]+)"
if [[ $TAG =~ $regex ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
build="${BASH_REMATCH[3]}"
fi

echo -e "Last version tag: \033[33m$major.$minor.$build\033[39m"
echo -e "Last version: \033[33m$major.$minor.$build\033[39m"

if [[ $(git diff-index HEAD) || $(git status) == *"is ahead"* ]]; then
echo -e "\n\033[33mPlease commit and push all changes" \
Expand All @@ -39,9 +39,9 @@ else
exit -1
fi

NEW_TAG=$(echo "$major.$minor.$build")
echo -e "New : \033[32m$NEW_TAG\033[39m"
echo -e "VERSION = '$NEW_TAG'" > $VERSION_FILE
NEW_TAG=$(echo "v.$major.$minor.$build")
echo -e "New version tag: \033[32m$NEW_TAG\033[39m"
echo -e "VERSION = '$major.$minor.$build'" > $VERSION_FILE

COMMIT_MSG=$(git log $TAG..HEAD --format=oneline | awk '{$1=""; print $0}')
COMMIT_MSG=$(echo -e "\n$COMMIT_MSG\n")
Expand Down

0 comments on commit 09e2a2d

Please sign in to comment.