Skip to content

Commit 0f842b3

Browse files
committed
add release script
1 parent 97d7234 commit 0f842b3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

script/release

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Usage:
4+
# script/release
5+
6+
# COLORS
7+
OFF='\033[0m'
8+
RED='\033[0;31m'
9+
GREEN='\033[0;32m'
10+
BLUE='\033[0;34m'
11+
12+
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
13+
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
14+
read -p 'New Release Tag (vX.X.X format): ' new_tag
15+
16+
# Updated regex to allow one or more digits in each segment
17+
tag_regex='^v[0-9]+\.[0-9]+\.[0-9]+$'
18+
echo "$new_tag" | grep -E -q $tag_regex
19+
20+
if [[ $? -ne 0 ]]; then
21+
echo -e "${RED}ERROR${OFF} - Tag: $new_tag is not valid. Please use vX.X.X format."
22+
exit 1
23+
fi
24+
25+
git tag -a $new_tag -m "$new_tag Release"
26+
27+
echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"
28+
29+
git push --tags
30+
31+
echo -e "${GREEN}OK${OFF} - Tags pushed to remote!"
32+
echo -e "${GREEN}DONE${OFF}"

0 commit comments

Comments
 (0)