35
35
# Created by argbash-init v2.10.0
36
36
# ARG_OPTIONAL_SINGLE([commitish],[c],[The commit to be tagged for release.],[HEAD])
37
37
# ARG_OPTIONAL_BOOLEAN([debug],[],[Print debugging output])
38
+ # ARG_OPTIONAL_BOOLEAN([dry-run],[],[Make only local changes])
38
39
# ARG_POSITIONAL_SINGLE([version],[The version of SSCG to release])
39
40
# ARG_DEFAULTS_POS([])
40
41
# ARG_HELP([Tags a new upstream release and submits])
@@ -67,15 +68,17 @@ _arg_version=
67
68
# THE DEFAULTS INITIALIZATION - OPTIONALS
68
69
_arg_commitish=" HEAD"
69
70
_arg_debug=" off"
71
+ _arg_dry_run=" off"
70
72
71
73
72
74
print_help ()
73
75
{
74
76
printf ' %s\n' " Tags a new upstream release and submits"
75
- printf ' Usage: %s [-c|--commitish <arg>] [--(no-)debug] [-h|--help] <version>\n' " $0 "
77
+ printf ' Usage: %s [-c|--commitish <arg>] [--(no-)debug] [--(no-)dry-run] [- h|--help] <version>\n' " $0 "
76
78
printf ' \t%s\n' " <version>: The version of SSCG to release"
77
79
printf ' \t%s\n' " -c, --commitish: The commit to be tagged for release. (default: 'HEAD')"
78
80
printf ' \t%s\n' " --debug, --no-debug: Print debugging output (off by default)"
81
+ printf ' \t%s\n' " --dry-run, --no-dry-run: Make only local changes (off by default)"
79
82
printf ' \t%s\n' " -h, --help: Prints help"
80
83
}
81
84
@@ -102,6 +105,10 @@ parse_commandline()
102
105
_arg_debug=" on"
103
106
test " ${1: 0: 5} " = " --no-" && _arg_debug=" off"
104
107
;;
108
+ --no-dry-run|--dry-run)
109
+ _arg_dry_run=" on"
110
+ test " ${1: 0: 5} " = " --no-" && _arg_dry_run=" off"
111
+ ;;
105
112
-h|--help)
106
113
print_help
107
114
exit 0
@@ -173,12 +180,14 @@ git diff --quiet HEAD --exit-code || git commit -sam "Updating version to ${_arg
173
180
# Tag the new release
174
181
git tag -sm " Releasing SSCG ${_arg_version} " ${tagname} ${_arg_commitish}
175
182
176
- # Push the tag to Github
177
- git push origin main
178
- git push origin tag ${tagname}
183
+ if [ " $_arg_dry_run " != " on" ]; then
184
+ # Push the tag to Github
185
+ git push origin main
186
+ git push origin tag ${tagname}
179
187
180
- # Create the release
181
- gh release create --generate-notes ${tagname}
188
+ # Create the release
189
+ gh release create --generate-notes ${tagname}
190
+ fi
182
191
183
192
184
193
# ^^^ TERMINATE YOUR CODE BEFORE THE BOTTOM ARGBASH MARKER ^^^
0 commit comments