Skip to content

Commit bd281fd

Browse files
committed
Updated branch detection
1 parent e22365b commit bd281fd

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Build/build.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Set the verbose preference
22
$VerbosePreference = 'Continue'
33

4-
Write-Verbose -Message "GITHUB_REF: $env:GITHUB_REF"
5-
Write-Verbose -Message "GITHUB_HEAD_REF: $env:GITHUB_HEAD_REF"
6-
Write-Verbose -Message "GITHUB_BASE_REF: $env:GITHUB_BASE_REF"
7-
84
# Download the System Center Visual Studio Authoring Extensions (VSAE)
95
$invokeWebRequestParams = @{
106
Uri = 'https://download.microsoft.com/download/4/4/6/446B60D0-4409-4F94-9433-D83B3746A792/VisualStudioAuthoringConsole_x64.msi'
@@ -59,17 +55,21 @@ foreach ( $solution in ( Get-ChildItem -Filter *.sln ) )
5955
$nextVersionBuild = $nextVersion.Build
6056
$nextVersionRevision = $nextVersion.Revision
6157

62-
# Increment the minor version
63-
if ( ( $env:GITHUB_REF -match '^refs/heads/dev' ) -and $env:GITHUB_HEAD_REF -and $env:GITHUB_BASE_REF )
64-
{
65-
$nextVersionMinor++
66-
}
67-
68-
# Increment the major version
69-
if ( ( $env:GITHUB_REF -match '^refs/heads/main' ) -and $env:GITHUB_HEAD_REF -and $env:GITHUB_BASE_REF )
58+
Write-Verbose -Message "Branch: $env:GITHUB_REF"
59+
switch -Regex ( $env:GITHUB_REF )
7060
{
71-
$nextVersionMajor++
72-
$nextVersionMinor = 0
61+
# Increment the minor version
62+
'^refs/heads/dev'
63+
{
64+
$nextVersionMinor++
65+
}
66+
67+
# Increment the major version
68+
'^refs/heads/main'
69+
{
70+
$nextVersionMajor++
71+
$nextVersionMinor = 0
72+
}
7373
}
7474

7575
# Increment the build

0 commit comments

Comments
 (0)