Add branch name in version

This commit is contained in:
angt
2016-03-09 10:20:01 +00:00
parent 8e8ad7178d
commit 03cd87df1c

View File

@@ -5,9 +5,14 @@
[ -z "${VERSION}" ] && VERSION=`cat VERSION 2>/dev/null`
[ -z "${VERSION}" ] && VERSION=0.0.0
[ -z "${VERSION}" ] && VERSION="0.0.0"
[ "$1" = "major" ] && printf ${VERSION%%.*} \
&& exit 0
BRANCH=`git rev-parse --abbrev-ref HEAD 2>/dev/null`
[ -n "${BRANCH}" ] && [ "${BRANCH}" != "master" ] \
&& VERSION=${VERSION}-${BRANCH}
printf ${VERSION} | tee VERSION