Add script for honeycomb version bump 28/10028/2
authorMarek Gradzki <mgradzki@cisco.com>
Tue, 9 Jan 2018 13:11:26 +0000 (14:11 +0100)
committerMarek Gradzki <mgradzki@cisco.com>
Tue, 9 Jan 2018 15:49:14 +0000 (16:49 +0100)
The script replaces version string in all files from the Git index.

Usage:

./bump_hc_version.sh 1.18.01-SNAPSHOT 1.18.01-RC1

Change-Id: Icee55617dd0cbcdd97c2a1c19f77986f7300e057
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
scripts/bump_hc_version.sh [new file with mode: 0755]

diff --git a/scripts/bump_hc_version.sh b/scripts/bump_hc_version.sh
new file mode 100755 (executable)
index 0000000..d152162
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Replaces version string in all files from the Git index
+# Usage:
+# ./bump_hc_version.sh 1.2.3-SNAPSHOT 1.2.3-RC1
+
+if [ "$#" -ne 2 ]; then
+    echo "Usage: ./bump_hc_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 -