From 95dbb38952e1e60a49fa66fab7be4a7822a250a6 Mon Sep 17 00:00:00 2001 From: EKS Distro PR Bot <75336432+eks-distro-pr-bot@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:19:18 -0400 Subject: [PATCH] Get latest Git tag by semver instead of chronological order (#8881) Co-authored-by: Abhay Krishna Arunachalam --- scripts/eksa_version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eksa_version.sh b/scripts/eksa_version.sh index 31fb52fe29c6..015440290f00 100755 --- a/scripts/eksa_version.sh +++ b/scripts/eksa_version.sh @@ -81,7 +81,7 @@ function eksa-version::get_next_eksa_version_for_ancestor() { minor_release=$(echo $ancestor_branch | grep -Eo "[[:digit:]]+.[[:digit:]]+") latest_tag=$(git tag -l "v${minor_release}.*" | sort -V | tail -n 1) if [[ -z "$latest_tag" ]]; then - latest_tag=$(git describe --tags "$(git rev-list --tags='v*.*.*' --max-count=1)") + latest_tag=$(git describe --tags "$(git tag -l "v*" --sort -v:refname | head -1)") release_version=$(echo "${latest_tag}" | awk -F. -v OFS=. '{$2++; $3=0; print}') else release_version=$(echo "${latest_tag}" | awk -F. -v OFS=. '{$3++; print}')