Skip to content

Commit b6499ce

Browse files
authored
Add PR versioning. (#8)
* Add icon, license, and source link to nuget. * Added PR versioning
1 parent 92fe267 commit b6499ce

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/GetBuildVersion.psm1

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ Function GetBuildVersion {
55
[string]$BuildNumber
66
)
77

8+
# If it is a PR, then grab the PR number and append to the base version.
9+
if ($VersionString -match "refs/pull/(?<pr>\d+)/merge") {
10+
return "$($BaseVersion)-pr.$($matches['pr'])"
11+
}
12+
813
# Process through regex
914
$VersionString -match "(?<major>\d+)(\.(?<minor>\d+))?(\.(?<patch>\d+))?(\-(?<pre>[0-9A-Za-z\-\.]+))?(\+(?<build>\d+))?" | Out-Null
1015

11-
if ($matches -eq $null) {
16+
# If the version string is the main branch, then we just append the build number
17+
if ($VersionString -eq "refs/heads/main" -or $matches -eq $null) {
1218
return "$($BaseVersion)-build.$($BuildNumber)"
1319
}
1420

0 commit comments

Comments
 (0)