diff --git a/entrypoint.sh b/entrypoint.sh index fd4b9116..b80b519e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -110,7 +110,7 @@ case "$tag_context" in git_refs=$(git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)') ;; *branch*) - git_refs=$(git tag --list --merged HEAD --sort=-committerdate) + git_refs=$(git tag --list --merged HEAD --sort=committerdate) ;; * ) echo "Unrecognised context" exit 1;; @@ -119,8 +119,8 @@ esac # get the latest tag that looks like a semver (with or without v) matching_tag_refs=$( (grep -E "$tagFmt" <<< "$git_refs") || true) matching_pre_tag_refs=$( (grep -E "$preTagFmt" <<< "$git_refs") || true) -tag=$(head -n 1 <<< "$matching_tag_refs") -pre_tag=$(head -n 1 <<< "$matching_pre_tag_refs") +tag=$(tail -n 1 <<< "$matching_tag_refs") +pre_tag=$(tail -n 1 <<< "$matching_pre_tag_refs") # if there are none, start tags at initial version if [ -z "$tag" ]