From 3759642dd2447027ed836e9b0afa2b42320a77d4 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 2 Oct 2024 12:51:27 +0300 Subject: [PATCH] fix(scripts): always return the latest tag in version.sh (#379) (cherry picked from commit 46c97a46b96f3ca12f9718766b7eb610e0f1e80d) --- scripts/version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/version.sh b/scripts/version.sh index 75dafcc..5666a2b 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -36,11 +36,11 @@ if [[ -z ${tag_list} ]]; then else current_commit=$(git rev-parse HEAD) # Try to find the last tag that contains the current commit - last_tag=$(git tag --contains "$current_commit" --sort=version:refname | head -n 1) + last_tag=$(git tag --contains "$current_commit" --sort=-version:refname | head -n 1) # If there is no tag that contains the current commit, # get the latest tag sorted by semver. if [[ -z "${last_tag}" ]]; then - last_tag=$(git tag --sort=version:refname | tail -n 1) + last_tag=$(git tag --sort=-version:refname | head -n 1) fi fi