File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 3
3
# Simple utility to bump the version and commit the change (locally).
4
4
#
5
5
# @param $1 New version number to bump to.
6
+ # @param $2 (optional) Extra string to add as a tag suffix.
6
7
7
8
# Validate input.
8
- if [[ ! " $1 " =~ ^[0-9\. ]+$ ]]; then
9
+ if [[ " $# " -lt 1 || " $# " -gt 2 ]] || [[ ! " $1 " =~ ^[0-9\. ]+$ ]]; then
9
10
echo " Invalid params."
10
- echo " Usage: $( basename $0 ) <version>, e.g. $( basename $0 ) 1.0.2"
11
+ echo " Usage: $( basename $0 ) <version> [<tag-suffix>] , e.g. $( basename $0 ) 1.0.2 rc1 "
11
12
exit 1
12
13
fi
13
14
@@ -17,7 +18,19 @@ cd "$(dirname ${BASH_SOURCE[0]})"
17
18
# Load common methods to call.
18
19
source ./git_utils
19
20
20
- init_safe " About to bump version to $1 and commit locally."
21
+ init_safe " About to bump version to $1 and commit locally. Any existing tag will be overwritten. "
21
22
22
23
echo ;
23
24
perform_version_bump " $1 " " ${PWD} "
25
+
26
+ tag_string=' '
27
+ if [ " $2 " ]; then
28
+ tag_string=" v$1 -$2 "
29
+ else
30
+ tag_string=" v$1 "
31
+ fi
32
+
33
+ git tag -f " ${tag_string} "
34
+
35
+ echo ;
36
+ echo ' Done.'
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ init_safe() {
24
24
# @see init_safe()
25
25
init_with_warning () {
26
26
echo ' Note: Please stash before continuing. Any existing changes will be lost.'
27
- echo ' Note: This is a destructive action! It will delete the online branch.'
27
+ echo ' Note: This is a destructive action! It will overwrite the online branch.'
28
28
echo ;
29
29
30
30
init_safe $1
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ GIT_ALLOW_PUSH_TO_MASTER=false
11
11
# @param $1 version name to update to.
12
12
# @param $2 root directory of project.
13
13
perform_version_bump () {
14
+ # Save the version number in a config file called 'example'.
14
15
echo " $1 " > " $2 /example.cfg"
15
16
16
17
# Commit the change.
You can’t perform that action at this time.
0 commit comments