summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorhackademix2018-08-26 00:37:52 +0200
committerhackademix2018-08-27 18:53:05 +0200
commite3f7df5df62b9f1b3ca5ea6a4293e73cce081b3e (patch)
tree5dda441bb512d96e6a62ab2a8e2bd2c3441d028f /build.sh
parent45c9d25da887f425fa0a33f5e2e1b4efbd20e5d7 (diff)
downloadnoscript-e3f7df5df62b9f1b3ca5ea6a4293e73cce081b3e.tar.gz
noscript-e3f7df5df62b9f1b3ca5ea6a4293e73cce081b3e.tar.xz
noscript-e3f7df5df62b9f1b3ca5ea6a4293e73cce081b3e.zip
Support for explicit version bump.
Diffstat (limited to 'build.sh')
-rw-r--r--build.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/build.sh b/build.sh
index 2e70909..8663a44 100644
--- a/build.sh
+++ b/build.sh
@@ -17,6 +17,24 @@ if [ "$1" == "rel" ]; then
exit
fi
if [ "$1" == "bump" ]; then
+ if [ "$2" ]; then
+ NEW_VER="$2"
+ if [[ "$2" == *.* ]]; then # full dotted version number
+ pattern='"\d+.*?'
+ NEW_VER='"'"$2"
+ elif [[ "$2" == *rc* ]]; then # new RC after release
+ if [[ "$2" == rc* ]]; then
+ echo >&2 "Please specify next release version (like 12rc1). Current is $VER"
+ exit 1
+ fi
+ pattern='\b(?:\d+rc)?\d+'
+ else # incremental version
+ pattern='\b\d+'
+ fi
+ REPLACE_EXPR='s/(?<PREAMBLE>"version":.*)'"$pattern"'"/$+{PREAMBLE}'"$NEW_VER"'"/'
+ perl -pi -e $REPLACE_EXPR "$MANIFEST_IN" && rm "$MANIFEST_IN".bak && "$0" bump
+ exit
+ fi
echo "Bumping to $VER"
git add "$MANIFEST_IN"
git commit -m "Version bump: $VER."