Skip to content

Commit 7f3150a

Browse files
committed
added tag-release.sh
1 parent e847834 commit 7f3150a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tag-release.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
SEMVER_REGEX='^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+)?$'
4+
5+
if [[ ! "$1" =~ $SEMVER_REGEX ]]; then
6+
echo "Usage: $0 <version> [message]"
7+
exit 1
8+
fi
9+
10+
VERSION=$1
11+
MESSAGE="$VERSION"
12+
13+
# Check if a message was provided as the second argument
14+
if [ -n "$2" ]; then
15+
MESSAGE="$2"
16+
fi
17+
18+
echo "Tagging $VERSION with message: '$MESSAGE'"
19+
20+
git tag -a $VERSION -m "$MESSAGE"
21+
git tag -a cli/$VERSION -m "$MESSAGE"
22+
git tag -a htmlform/$VERSION -m "$MESSAGE"
23+
git tag -a cmd/gen-func-wrappers/$VERSION -m "$MESSAGE"
24+
25+
echo "Tags to be pushed:"
26+
git push --tags --dry-run
27+
28+
echo "Do you want to push tags to origin? (y/n)"
29+
read CONFIRM
30+
if [[ "$CONFIRM" == "y" || "$CONFIRM" == "Y" ]]; then
31+
git push origin --tags
32+
else
33+
git tag -d $VERSION
34+
git tag -d cli/$VERSION
35+
git tag -d htmlform/$VERSION
36+
git tag -d cmd/gen-func-wrappers/$VERSION
37+
echo "Reverted local $VERSION tags"
38+
fi

0 commit comments

Comments
 (0)