Skip to content

Commit af22abb

Browse files
author
Andrew Omondi
committed
build: fix validate version update script to align to csproj changes
1 parent d390dd4 commit af22abb

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

pipelines/ci-build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ extends:
6464
inputs:
6565
command: restore
6666
projects: '**/*.csproj'
67+
- task: PowerShell@2
68+
displayName: 'Validate updated version'
69+
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded())
70+
inputs:
71+
targetType: filePath
72+
filePath: '$(Build.SourcesDirectory)\scripts\ValidateUpdatedNugetVersion.ps1'
73+
arguments: '-packageName "Microsoft.Graph.Beta" -projectPath "$(Build.SourcesDirectory)\src\Microsoft.Graph\Microsoft.Graph.Beta.csproj"'
74+
pwsh: true
75+
enabled: true
6776
- powershell: |
6877
# This allows us to not have to checkin .csproj files with DelaySign and SignAssembly set to to true. If the flag is set,
6978
# then project is not debuggable with SignAssembly set to true.
@@ -110,15 +119,6 @@ extends:
110119
inputs:
111120
command: 'test'
112121
arguments: '--configuration $(BuildConfiguration) --no-build --verbosity normal'
113-
- task: PowerShell@2
114-
displayName: 'Validate updated version'
115-
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded())
116-
inputs:
117-
targetType: filePath
118-
filePath: '$(Build.SourcesDirectory)\scripts\ValidateUpdatedNugetVersion.ps1'
119-
arguments: '-packageName "Microsoft.Graph.Beta" -projectPath "$(Build.SourcesDirectory)\src\Microsoft.Graph\Microsoft.Graph.Beta.csproj"'
120-
pwsh: true
121-
enabled: true
122122
- task: EsrpCodeSigning@5
123123
displayName: 'ESRP DLL Strong Name (Microsoft.Graph.Beta)'
124124
inputs:

scripts/ValidateUpdatedNugetVersion.ps1

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@ Param(
2828

2929
[xml]$xmlDoc = Get-Content $projectPath
3030

31-
# Assumption: VersionPrefix is set in the first property group.
32-
$versionPrefixString = $xmlDoc.Project.PropertyGroup[0].VersionPrefix
33-
if($xmlDoc.Project.PropertyGroup[0].VersionSuffix){
34-
$versionPrefixString = $versionPrefixString + "-" + $xmlDoc.Project.PropertyGroup[0].VersionSuffix
35-
}
36-
31+
# Assumption: Version is set in the first property group.
32+
$versionString = $xmlDoc.Project.PropertyGroup[0].Version
3733

3834
# System.Version, get the version prefix.
39-
$currentProjectVersion = [System.Management.Automation.SemanticVersion]"$versionPrefixString"
35+
$currentProjectVersion = [System.Management.Automation.SemanticVersion]"$versionString"
4036

4137
# API is case-sensitive
4238
$packageName = $packageName.ToLower()

0 commit comments

Comments
 (0)