Skip to content

Commit

Permalink
Update release script
Browse files Browse the repository at this point in the history
Allow passing the desired version when releasing.
  • Loading branch information
elyezer committed Feb 10, 2017
1 parent 79235e3 commit 91572eb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ git checkout master
git merge --ff-only upstream/master

OLD_VERSION="$(git tag --list | sort -V | tail -n 1)"
MAJOR_VERSION="$(echo ${OLD_VERSION} | cut -d . -f 1)"
MINOR_VERSION="$(echo ${OLD_VERSION} | cut -d . -f 2)"
NEW_VERSION="${MAJOR_VERSION}.$((${MINOR_VERSION} + 1)).0"
if [[ $# -gt 0 ]]; then
NEW_VERSION="${1}"
else
MAJOR_VERSION="$(echo "${OLD_VERSION}" | cut -d . -f 1)"
MINOR_VERSION="$(echo "${OLD_VERSION}" | cut -d . -f 2)"
NEW_VERSION="${MAJOR_VERSION}.$((MINOR_VERSION + 1)).0"
fi

if [[ $(echo -e "${OLD_VERSION}\n${NEW_VERSION}" | sort -V | tail -n 1) = "${OLD_VERSION}" ]]; then
echo "The version must be greater than \"${OLD_VERSION}\""
exit 1
fi

# Bump version number
echo "${NEW_VERSION}" > VERSION
Expand Down

0 comments on commit 91572eb

Please sign in to comment.