From 88322eba1dd7a4c71da6b0f4046511c4a2df9364 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Mon, 6 Nov 2023 11:22:02 -0800 Subject: [PATCH 1/2] chore: Fixes version prefix and suffix check. --- scripts/ValidateProjectVersionUpdated.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ValidateProjectVersionUpdated.ps1 b/scripts/ValidateProjectVersionUpdated.ps1 index c9b9f7c..6f3323f 100644 --- a/scripts/ValidateProjectVersionUpdated.ps1 +++ b/scripts/ValidateProjectVersionUpdated.ps1 @@ -29,9 +29,9 @@ Param( [xml]$xmlDoc = Get-Content $projectPath # Assumption: There is only one PropertyGroup -$versionPrefixString = $xmlDoc.Project.PropertyGroup.VersionPrefix -if($xmlDoc.Project.PropertyGroup.VersionSuffix){ - $versionPrefixString = $versionPrefixString + "-" + $xmlDoc.Project.PropertyGroup.VersionSuffix +$versionPrefixString = $xmlDoc.Project.PropertyGroup.VersionPrefix[0] +if ($xmlDoc.Project.PropertyGroup.VersionSuffix.Count) { + $versionPrefixString = $versionPrefixString + "-" + $xmlDoc.Project.PropertyGroup.VersionSuffix[0] } @@ -47,7 +47,7 @@ Try { $nugetIndex = Invoke-RestMethod -Uri $url -Method Get } Catch { - if ($_.ErrorDetails.Message && $_.ErrorDetails.Message.Contains("The specified blob does not exist.")) { + if ($_.ErrorDetails.Message -and $_.ErrorDetails.Message.Contains("The specified blob does not exist.")) { Write-Host "No package exists. You will probably be publishing $packageName for the first time." Exit # exit gracefully } From 8f8037538649ef367c21ace39c312dc69edbbb27 Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Mon, 6 Nov 2023 12:41:04 -0800 Subject: [PATCH 2/2] chore: Use correct PropertyGroup --- scripts/ValidateProjectVersionUpdated.ps1 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/ValidateProjectVersionUpdated.ps1 b/scripts/ValidateProjectVersionUpdated.ps1 index 6f3323f..d54945b 100644 --- a/scripts/ValidateProjectVersionUpdated.ps1 +++ b/scripts/ValidateProjectVersionUpdated.ps1 @@ -28,13 +28,12 @@ Param( [xml]$xmlDoc = Get-Content $projectPath -# Assumption: There is only one PropertyGroup -$versionPrefixString = $xmlDoc.Project.PropertyGroup.VersionPrefix[0] -if ($xmlDoc.Project.PropertyGroup.VersionSuffix.Count) { - $versionPrefixString = $versionPrefixString + "-" + $xmlDoc.Project.PropertyGroup.VersionSuffix[0] +$PropertyGroup = $xmlDoc.Project.PropertyGroup | Where-Object -Property PackageId -eq "Microsoft.OpenApi.ApiManifest" +$versionPrefixString = $PropertyGroup.VersionPrefix +if ($PropertyGroup.VersionSuffix) { + $versionPrefixString = $versionPrefixString + "-" + $PropertyGroup.VersionSuffix } - # System.Version, get the version prefix. $currentProjectVersion = [System.Management.Automation.SemanticVersion]"$versionPrefixString"