Skip to content

Commit 081e185

Browse files
committed
fix release script
1 parent 5479e29 commit 081e185

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

script/release

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# COLORS
1616
OFF='\033[0m'
17-
# RED='\033[0;31m'
17+
RED='\033[0;31m'
1818
GREEN='\033[0;32m'
1919
BLUE='\033[0;34m'
2020

@@ -27,16 +27,17 @@ if [[ -z "$latest_tag" ]]; then
2727
fi
2828

2929
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
30-
read -p 'New Release Tag (vX.X.X format): ' new_tag
31-
32-
tag_regex='^v\d\.\d\.\d$'
33-
echo "$new_tag" | grep -P -q $tag_regex
34-
35-
if [[ $? -ne 0 ]]; then
36-
echo "Tag: $new_tag is valid"
30+
read -r -p 'New Release Tag (vX.X.X format): ' new_tag
31+
32+
tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$'
33+
if echo "$new_tag" | grep -q -E "$tag_regex"; then
34+
echo -e "Tag: ${BLUE}$new_tag${OFF} is valid"
35+
else
36+
echo -e "Tag: ${BLUE}$new_tag${OFF} is ${RED}not valid${OFF} (must be in vX.X.X format)"
37+
exit 1
3738
fi
3839

39-
git tag -a $new_tag -m "$new_tag Release"
40+
git tag -a "$new_tag" -m "$new_tag Release"
4041

4142
echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"
4243

0 commit comments

Comments
 (0)