Use full hash as version if no tags

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2018-05-05 13:17:55 +00:00
parent 841c2afed0
commit ee9ed7e3a6
2 changed files with 6 additions and 8 deletions

View File

@@ -1,13 +1,12 @@
#!/bin/sh
[ -z "${VERSION}" ] && VERSION=`git describe --tags --match='v[0-9].*' 2>/dev/null` \
&& VERSION=${VERSION#v}
[ -z "${VERSION}" ] && VERSION="$(git describe --tags --match='v[0-9].*' 2>/dev/null)" \
&& VERSION="${VERSION#v}"
[ -z "${VERSION}" ] && VERSION=`cat VERSION 2>/dev/null`
[ -z "${VERSION}" ] && VERSION="$(git rev-parse HEAD 2>/dev/null)"
[ -z "${VERSION}" ] && VERSION=0.0.0
[ -z "${VERSION}" ] && VERSION="$(cat VERSION 2>/dev/null)"
[ "$1" = "major" ] && printf ${VERSION%%.*} \
&& exit 0
[ -z "${VERSION}" ] && VERSION="0.0.0"
printf ${VERSION} | tee VERSION
printf "%s" "${VERSION}" | tee VERSION