Skip to content

Commit 3759642

Browse files
committed
fix(scripts): always return the latest tag in version.sh (#379)
(cherry picked from commit 46c97a4)
1 parent 0ec371f commit 3759642

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/version.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ if [[ -z ${tag_list} ]]; then
3636
else
3737
current_commit=$(git rev-parse HEAD)
3838
# Try to find the last tag that contains the current commit
39-
last_tag=$(git tag --contains "$current_commit" --sort=version:refname | head -n 1)
39+
last_tag=$(git tag --contains "$current_commit" --sort=-version:refname | head -n 1)
4040
# If there is no tag that contains the current commit,
4141
# get the latest tag sorted by semver.
4242
if [[ -z "${last_tag}" ]]; then
43-
last_tag=$(git tag --sort=version:refname | tail -n 1)
43+
last_tag=$(git tag --sort=-version:refname | head -n 1)
4444
fi
4545
fi
4646

0 commit comments

Comments
 (0)