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