Skip to content

Commit

Permalink
Merge pull request #584 from strukturag/improve-version
Browse files Browse the repository at this point in the history
Improve get-version.sh
  • Loading branch information
fancycode authored Oct 26, 2023
2 parents 1fb2d93 + b1bd1a1 commit 825d95c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/get-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ ROOT="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"

VERSION=
if [ -s "$ROOT/../version.txt" ]; then
VERSION=$(cat "$ROOT/../version.txt" | tr -d '[:space:]')
VERSION=$(tr -d '[:space:]' < "$ROOT/../version.txt")
fi
if [ -z $VERSION ] && [ -d "$ROOT/../.git" ]; then
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
fi

if [ -z $VERSION ]; then
if [ -z "$VERSION" ]; then
VERSION=unknown
fi

Expand Down

0 comments on commit 825d95c

Please sign in to comment.