Change default behavior to remove a prerelease tag if present instead of a minor version bump
This commit is contained in:
parent
a233a1c822
commit
19e4f70244
|
@ -6,7 +6,9 @@ usage() {
|
|||
usage: $0 [major|minor|patch|-preXYZ]
|
||||
|
||||
Increments the Cargo.toml version.
|
||||
A minor version increment is the default
|
||||
|
||||
Default:
|
||||
* Removes the prerelease tag if present, otherwise the minor version is incremented.
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
@ -47,10 +49,19 @@ semverParseInto "$(readCargoVariable version "${Cargo_tomls[0]}")" MAJOR MINOR P
|
|||
[[ -n $MAJOR ]] || usage
|
||||
|
||||
currentVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
|
||||
|
||||
bump=$1
|
||||
if [[ -z $bump ]]; then
|
||||
if [[ -n $SPECIAL ]]; then
|
||||
bump=dropspecial # Remove prerelease tag
|
||||
else
|
||||
bump=minor
|
||||
fi
|
||||
fi
|
||||
SPECIAL=""
|
||||
|
||||
# Figure out what to increment
|
||||
case ${1:-minor} in
|
||||
case $bump in
|
||||
patch)
|
||||
PATCH=$((PATCH + 1))
|
||||
;;
|
||||
|
@ -60,6 +71,8 @@ major)
|
|||
minor)
|
||||
MINOR=$((MINOR+ 1))
|
||||
;;
|
||||
dropspecial)
|
||||
;;
|
||||
-*)
|
||||
if [[ $1 =~ ^-[A-Za-z0-9]*$ ]]; then
|
||||
SPECIAL="$1"
|
||||
|
|
Loading…
Reference in New Issue