Skip to content

Commit

Permalink
use git ls-remote to get version
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Dec 21, 2022
1 parent 1f76ab3 commit 79526c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/current-version
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ strip_pkg() {
sed -Ee 's/-(deb|rpm)[0-9]+//' <<< $1
}

latest_tag="git describe --abbrev=0 --match v[0-9]*"
SCRIPTS_DIR="$( cd "$( dirname ${BASH_SOURCE[0]} )" && pwd )"
REPO_DIR="$( cd "$SCRIPTS_DIR/.." && pwd )"

tag=$($latest_tag --exact-match 2>/dev/null)
tag="$( git -C "$REPO_DIR" describe --abbrev=0 --tags --exact-match --match 'v[0-9]*' 2>/dev/null || true )"

if test -z $tag || [[ $tag =~ (deb|rpm) ]]
then
tag=$($latest_tag)-post
tag="$( git ls-remote --refs --tags -q | tail -n 1 | awk -F/ '{ print $3 }' )-post"
fi

if test -z $tag
Expand Down

0 comments on commit 79526c7

Please sign in to comment.