1
1
#! /bin/bash
2
2
3
- SEMVER_REGEX=' ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+)?$'
3
+ # Just in case the script is run from another directory
4
+ SCRIPT_DIR=$( cd -P -- $( dirname -- " $0 " ) && pwd -P)
5
+ cd $SCRIPT_DIR
6
+
7
+ MODULE_PATHS=(" " " cli/" " htmlform/" " cmd/gen-func-wrappers/" )
4
8
9
+ SEMVER_REGEX=' ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+)?$'
5
10
if [[ ! " $1 " =~ $SEMVER_REGEX ]]; then
6
11
echo " Usage: $0 <version> [message]"
7
12
exit 1
8
13
fi
9
14
10
15
VERSION=$1
11
16
MESSAGE=" $VERSION "
12
-
13
- # Check if a message was provided as the second argument
14
17
if [ -n " $2 " ]; then
15
- MESSAGE=" $2 "
18
+ MESSAGE=" $2 " # provided as the second argument
16
19
fi
17
20
18
21
echo " Tagging $VERSION with message: '$MESSAGE '"
19
22
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 "
23
+ for PREFIX in " ${MODULE_PATHS[@]} " ; do
24
+ git tag -a " ${PREFIX}${VERSION} " -m " $MESSAGE "
25
+ done
24
26
25
27
echo " Tags to be pushed:"
26
28
git push --tags --dry-run
@@ -30,9 +32,8 @@ read CONFIRM
30
32
if [[ " $CONFIRM " == " y" || " $CONFIRM " == " Y" ]]; then
31
33
git push origin --tags
32
34
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
35
+ for PREFIX in " ${MODULE_PATHS[@]} " ; do
36
+ git tag -d " ${PREFIX}${VERSION} "
37
+ done
37
38
echo " Reverted local $VERSION tags"
38
39
fi
0 commit comments