File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131
3232# Variables
3333semver_tag_regex=' v[0-9]+\.[0-9]+\.[0-9]+$'
34- semver_tag_glob=' v[0-9].[0-9].[0-9]*'
3534git_remote=' origin'
3635major_semver_tag_regex=' \(v[0-9]*\)'
3736
@@ -44,8 +43,13 @@ BOLD_PURPLE='\033[1;35m'
4443BOLD_UNDERLINED=' \033[1;4m'
4544BOLD=' \033[1m'
4645
47- # 1. Retrieve the latest release tag
48- if ! latest_tag=$( git describe --abbrev=0 --match=" $semver_tag_glob " ) ; then
46+ # 1. Retrieve the latest release tag (before creating the new one)
47+ # Get all tags matching the pattern and find the latest one
48+ all_tags=$( git tag --list --sort=-version:refname | grep -E " $semver_tag_regex " | head -1)
49+ if [ -n " $all_tags " ]; then
50+ latest_tag=" $all_tags "
51+ echo -e " Found latest tag: ${BOLD_BLUE}${latest_tag}${OFF} "
52+ else
4953 # There are no existing release tags
5054 echo -e " No tags found (yet) - Continue to create and push your first tag"
5155 latest_tag=" [unknown]"
@@ -88,7 +92,7 @@ if [[ "$latest_tag" = "[unknown]" ]]; then
8892 # This is the first major release
8993 is_major_release=' yes'
9094else
91- # Compare the major version of the latest tag with the new tag
95+ # Compare the major version of the previous latest tag with the new tag
9296 latest_major_release_tag=$( expr " $latest_tag " : " $major_semver_tag_regex " )
9397
9498 if ! [[ " $new_major_release_tag " = " $latest_major_release_tag " ]]; then
You can’t perform that action at this time.
0 commit comments