From ddfca56205782ddc9e9755fe570e6bc4155ac120 Mon Sep 17 00:00:00 2001 From: Crystal YU Date: Wed, 13 Nov 2024 14:18:13 +0800 Subject: [PATCH] add version and readMe or typespecProject information in ci output (#47013) * add version and readMe or typespecProject * check the version existence --- eng/scripts/Invoke-GenerateAndBuildV2.ps1 | 2 ++ eng/scripts/automation/GenerateAndBuildLib.ps1 | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/eng/scripts/Invoke-GenerateAndBuildV2.ps1 b/eng/scripts/Invoke-GenerateAndBuildV2.ps1 index 50ab22aa9308d..47c61f9785adc 100644 --- a/eng/scripts/Invoke-GenerateAndBuildV2.ps1 +++ b/eng/scripts/Invoke-GenerateAndBuildV2.ps1 @@ -87,6 +87,7 @@ for ($i = 0; $i -le $readmeFiles.Count - 1; $i++) { $autorestConfigYaml = ConvertTo-YAML $yml } Invoke-GenerateAndBuildSDK -readmeAbsolutePath $readme -sdkRootPath $sdkPath -autorestConfigYaml "$autorestConfigYaml" -downloadUrlPrefix "$downloadUrlPrefix" -generatedSDKPackages $generatedSDKPackages + $generatedSDKPackages[$generatedSDKPackages.Count - 1]['readmeMd'] = @($readmeFile) } #update services without readme.md @@ -156,6 +157,7 @@ if ($relatedTypeSpecProjectFolder) { -generatedSDKPackages $generatedSDKPackages ` -specRepoRoot $swaggerDir } + $generatedSDKPackages[$generatedSDKPackages.Count - 1]['typespecProject'] = @($typespecRelativeFolder) } } $outputJson = [PSCustomObject]@{ diff --git a/eng/scripts/automation/GenerateAndBuildLib.ps1 b/eng/scripts/automation/GenerateAndBuildLib.ps1 index 5d0d78f46803e..58206af3573dd 100644 --- a/eng/scripts/automation/GenerateAndBuildLib.ps1 +++ b/eng/scripts/automation/GenerateAndBuildLib.ps1 @@ -891,7 +891,18 @@ function GeneratePackage() $ciFilePath = "sdk/$service/ci.mgmt.yml" } + # get the sdk version + $version = "" + $projectFile = Join-Path $srcPath "$packageName.csproj" + $csproj = new-object xml + $csproj.PreserveWhitespace = $true + $csproj.Load($projectFile) + $versionNode = ($csproj | Select-Xml "Project/PropertyGroup/Version").Node + if ($versionNode) { + $version = $versionNode.InnerText + } $packageDetails = @{ + version=$version; packageName="$packageName"; result=$result; path=@("$path", "$ciFilePath"); @@ -899,7 +910,7 @@ function GeneratePackage() artifacts=$artifacts; apiViewArtifact=$apiViewArtifact; language=".Net"; - changelog=$changelog + changelog=$changelog; } if ($null -ne $installInstructions) {