Add script for bumping hc2vpp version 55/13755/1
authorMarek Gradzki <[email protected]>
Fri, 27 Jul 2018 06:31:04 +0000 (08:31 +0200)
committerMarek Gradzki <[email protected]>
Fri, 27 Jul 2018 06:31:06 +0000 (08:31 +0200)
The script simply replaces version string
in all files from GIT index.

TODO(HC2VPP-369): does not cover updating package
versions and release notes.

Change-Id: Iff4d84ced69873bd8d7e7d58714750d8f2b355e6
Signed-off-by: Marek Gradzki <[email protected]>
scripts/bump_version.sh [new file with mode: 0755]

diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh
new file mode 100755 (executable)
index 0000000..b8a2add
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Replaces version string in all files from the Git index
+# Usage:
+# ./bump_version.sh 1.2.3-SNAPSHOT 1.2.3-RC1
+
+if [ "$#" -ne 2 ]; then
+    echo "Usage: ./bump_version.sh OLD_VERSION NEW_VERSION"
+    exit 1
+fi
+
+OLD_VERSION=$1
+NEW_VERSION=$2
+BUMP_SCRIPT_FILENAME=$(basename "$0")
+GIT_ROOT=$(git rev-parse --show-toplevel)
+
+cd $GIT_ROOT
+
+for i in $(git ls-files); do
+  sed -i "s/${OLD_VERSION}/${NEW_VERSION}/g" $i
+done
+
+cd -