Skip to content

Commit 0330743

Browse files
committed
Default to alpha when bumping suffix
1 parent 3a21fc0 commit 0330743

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Build/set-version.psm1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,18 @@ function BumpSuffix([string] $oldSuffix) {
116116

117117
# A suffix is a dash '-', then a sequcence of word characters followed by an optional number
118118
# Example:
119-
# -alpha => -alpha002
120-
# -alpha1 => -alpha002
119+
# "" => "-alpha001"
120+
# "-beta" => "-beta001"
121+
# "-beta1"=> "-beta002"
121122
$match = [regex]::Match($oldSuffix, '^-([a-zA-Z]+)(\d+)?$');
122123
$oldSuffix = $match.Groups[1].Value
124+
if (!$oldSuffix) {
125+
$oldSuffix = "alpha"
126+
}
127+
123128
$numberGroup = $match.Groups[2]
124129

125-
$number = if ($numberGroup.Success) { 1+$match.Groups[2].Value } else { 2 }
130+
$number = if ($numberGroup.Success) { 1+$match.Groups[2].Value } else { 1 }
126131

127132
# Use 3 digits for the number "-alpha003", for 999 releases lexically sorted.
128133
return [string]::Format("-{0}{1:D3}", $oldSuffix, $number)

0 commit comments

Comments
 (0)