Get version from tag if building from tag.

This commit is contained in:
Joachim Bauch 2023-10-26 14:09:26 +02:00
parent a2a3771906
commit 4e140dd334
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -7,8 +7,11 @@ if [ -s "$ROOT/../version.txt" ]; then
VERSION=$(cat "$ROOT/../version.txt" | tr -d '[:space:]')
fi
if [ -z $VERSION ] && [ -d "$ROOT/../.git" ]; then
TAG=$(git tag --points-at HEAD | sed 's/v//')
if [ "$1" == "--tar" ]; then
VERSION=$(git describe --dirty --tags --always | sed 's/debian\///g')
elif [ -n "$TAG" ]; then
VERSION="$TAG"
else
VERSION=$(git log -1 --pretty=%H)
fi