From 91572eb7a1bfac4307a613e744fcdd462ba2d823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ely=C3=A9zer=20Rezende?= Date: Fri, 10 Feb 2017 11:36:10 -0200 Subject: [PATCH] Update release script Allow passing the desired version when releasing. --- release.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index 1815557..1f9bb8b 100755 --- a/release.sh +++ b/release.sh @@ -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