Skip to content

Commit

Permalink
Limit tags to those matching semver (#7698)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhay-krishna authored Feb 23, 2024
1 parent 6978559 commit 228ae9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/eksa_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ function eksa-version::get_next_eksa_version_for_ancestor() {
# If the branch is main, then get the latest tag by date and
# bump one minor version and use patch 0

latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
latest_tag=$(git describe --tags "$(git rev-list --tags='v*.*.*' --max-count=1)")

release_version=$(echo "${latest_tag}" | awk -F. -v OFS=. '{$2++; $3=0; print}')
else
# For a release branch, get the latest tag for the release minor version and bump the patch version
# If there is not tag yet, use latest tag by date but bumping the minor version and using 0 as the patch
# Silence stdeer as the command will fail if there are no tags
latest_tag=$(git describe --tags --match "v$(echo "$ancestor_branch" | sed 's/release-//').*" "$(git rev-list --tags --max-count=1)" 2>/dev/null)
latest_tag=$(git describe --tags --match "v$(echo "$ancestor_branch" | sed 's/release-//').*" "$(git rev-list --tags='v*.*.*' --max-count=1)" 2>/dev/null)
if [[ -z "$latest_tag" ]]; then
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
latest_tag=$(git describe --tags "$(git rev-list --tags='v*.*.*' --max-count=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}')
Expand Down

0 comments on commit 228ae9c

Please sign in to comment.