11#! /bin/bash
22
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/" )
48
9+ SEMVER_REGEX=' ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+)?$'
510if [[ ! " $1 " =~ $SEMVER_REGEX ]]; then
611 echo " Usage: $0 <version> [message]"
712 exit 1
813fi
914
1015VERSION=$1
1116MESSAGE=" $VERSION "
12-
13- # Check if a message was provided as the second argument
1417if [ -n " $2 " ]; then
15- MESSAGE=" $2 "
18+ MESSAGE=" $2 " # provided as the second argument
1619fi
1720
1821echo " Tagging $VERSION with message: '$MESSAGE '"
1922
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
2426
2527echo " Tags to be pushed:"
2628git push --tags --dry-run
@@ -30,9 +32,8 @@ read CONFIRM
3032if [[ " $CONFIRM " == " y" || " $CONFIRM " == " Y" ]]; then
3133 git push origin --tags
3234else
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
3738 echo " Reverted local $VERSION tags"
3839fi
0 commit comments