Skip to content

Commit cbd70de

Browse files
committed
Fix release script
1 parent 03a38c1 commit cbd70de

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

script/release

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ set -e
3131

3232
# Variables
3333
semver_tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$'
34-
semver_tag_glob='v[0-9].[0-9].[0-9]*'
3534
git_remote='origin'
3635
major_semver_tag_regex='\(v[0-9]*\)'
3736

@@ -44,8 +43,13 @@ BOLD_PURPLE='\033[1;35m'
4443
BOLD_UNDERLINED='\033[1;4m'
4544
BOLD='\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'
9094
else
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

0 commit comments

Comments
 (0)