2015-12-19 10:07:20 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
if [ -d .git ]; then
|
|
|
|
|
# Get version from git tags, removing the 'v' prefix
|
2025-05-15 21:51:10 +02:00
|
|
|
VERSION=$(git describe --match 'v*' 2>/dev/null | sed 's/^v//')
|
2016-01-05 10:56:34 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -f .version ]; then
|
2015-12-19 10:07:20 +01:00
|
|
|
# Get version from the .version file
|
2025-05-15 21:51:10 +02:00
|
|
|
VERSION=$(cat .version)
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z "$VERSION" ] && [ -d .git ]; then
|
|
|
|
|
# Fall back to short commit hash
|
|
|
|
|
VERSION=0-$(git rev-parse --short HEAD 2>/dev/null)
|
2016-01-05 10:56:34 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z $VERSION ]; then
|
2025-05-15 21:51:10 +02:00
|
|
|
# No version, but still use a number
|
|
|
|
|
VERSION="0"
|
2015-12-19 10:07:20 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
printf '%s' "$VERSION"
|