@@ -47,32 +47,37 @@ foreach ( $solution in ( Get-ChildItem -Filter *.sln ) )
4747 $projectUserFile = Get-ChildItem - Path $projectFile.Directory - Filter * .mpproj.user
4848 $projectUserFileXml = [System.Xml.XmlDocument ] ( $projectUserFile | Get-Content )
4949 $nextVersion = [System.Version ]::new($projectUserFileXml.Project.PropertyGroup.DeploymentNextVersion )
50+ Write-Verbose - Message " Current Management Pack Version: $ ( $nextVersion.ToString ()) "
5051
5152 # Break out the version components to make it easier to work with
5253 $nextVersionMajor = $nextVersion.Major
5354 $nextVersionMinor = $nextVersion.Minor
5455 $nextVersionBuild = $nextVersion.Build
5556 $nextVersionRevision = $nextVersion.Revision
5657
57- # Increment the minor version
58- if ( ( $env: GITHUB_REF -match ' ^refs/heads/dev ' ) -and $ env: GITHUB_HEAD_REF -and $ env: GITHUB_BASE_REF )
58+ Write-Verbose - Message " Branch: $ env: GITHUB_REF "
59+ switch - Regex ( $env: GITHUB_REF )
5960 {
60- $nextVersionMinor ++
61- }
62-
63- # Increment the major version
64- if ( ( $env: GITHUB_REF -match ' ^refs/heads/main' ) -and $env: GITHUB_HEAD_REF -and $env: GITHUB_BASE_REF )
65- {
66- $nextVersionMajor ++
67- $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+ }
6873 }
6974
7075 # Increment the build
7176 $nextVersionBuild ++
7277
7378 # Create the new version
7479 $newVersion = [System.Version ]::new($nextVersionMajor , $nextVersionMinor , $nextVersionBuild , $nextVersionRevision )
75- Write-Verbose - Message " Management Pack Version: $ ( $newVersion.ToString ()) "
80+ Write-Verbose - Message " New Management Pack Version: $ ( $newVersion.ToString ()) "
7681
7782 # Set the next management pack version in the project file
7883 $projectFileXml = [System.Xml.XmlDocument ] ( $projectFile | Get-Content )
0 commit comments