Files
ziti/bump-semver.sh
T
Curt Tudor 7950bade6f ZT-450: setting up build-automation (#3)
* ZT-450: setting up build-automation
2019-12-04 10:07:29 -05:00

22 lines
684 B
Bash
Executable File

#!/bin/bash
#
# This script is invoked from the pre-bump-semver.sh script if the following is true:
# 1) the branch involved is master
# 2) the most recent commit was a merge-commit
#
# What we do here is increment the "patch" level in the VERSION file
#
MANIFEST="common/version/VERSION"
declare -x SCRIPTPATH="${0}"
FULLPATH=${SCRIPTPATH%/*}/$MANIFEST
if [ -f $FULLPATH ]
then
LINE=$(grep -o ${FULLPATH} -e '^[0]\.[0-9]*\.[0-9]*');
IFS='.' read -r -a array <<< "$LINE"
VERSION=(${array[2]});
INCREMENTED=$(($VERSION+1))
sed "s/${array[0]}\.${array[1]}\.${array[2]}/${array[0]}\.${array[1]}\.${INCREMENTED}/" $FULLPATH > $FULLPATH.tmp && mv $FULLPATH.tmp $FULLPATH
fi;