diff --git a/eng/common/scripts/artifact-metadata-parsing.ps1 b/eng/common/scripts/artifact-metadata-parsing.ps1 index bc2691498809..2d2362f0d0d9 100644 --- a/eng/common/scripts/artifact-metadata-parsing.ps1 +++ b/eng/common/scripts/artifact-metadata-parsing.ps1 @@ -87,14 +87,16 @@ function ParseMavenPackage($pkg, $workingDirectory) { $pkgVersion = $contentXML.project.version $groupId = if ($contentXML.project.groupId -eq $null) { $contentXML.project.parent.groupId } else { $contentXML.project.groupId } $releaseNotes = "" + $readmeContent = "" # if it's a snapshot. return $null (as we don't want to create tags for this, but we also don't want to fail) if ($pkgVersion.Contains("SNAPSHOT")) { return $null } - if (@(Get-ChildItem -Path $pkg.DirectoryName -Recurse -Include "$($pkg.Basename)-changelog.md")[0]) { - $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $pkg.DirectoryName -Recurse -Include "$($pkg.Basename)-changelog.md")[0] + $changeLogLoc = @(Get-ChildItem -Path $pkg.DirectoryName -Recurse -Include "$($pkg.Basename)-changelog.md")[0] + if ($changeLogLoc) { + $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc } $readmeContentLoc = @(Get-ChildItem -Path $pkg.DirectoryName -Recurse -Include "$($pkg.Basename)-readme.md")[0] @@ -159,6 +161,7 @@ function ParseNPMPackage($pkg, $workingDirectory) { $workFolder = "$workingDirectory$($pkg.Basename)" $origFolder = Get-Location $releaseNotes = "" + $readmeContent = "" New-Item -ItemType Directory -Force -Path $workFolder cd $workFolder @@ -167,8 +170,9 @@ function ParseNPMPackage($pkg, $workingDirectory) { $packageJSON = ResolvePkgJson -workFolder $workFolder | Get-Content | ConvertFrom-Json - if (@(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]) { - $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0] + $changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0] + if ($changeLogLoc) { + $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc } $readmeContentLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "README.md")[0] @@ -218,14 +222,17 @@ function ParseNugetPackage($pkg, $workingDirectory) { $origFolder = Get-Location $zipFileLocation = "$workFolder/$($pkg.Basename).zip" $releaseNotes = "" + $readmeContent = "" + New-Item -ItemType Directory -Force -Path $workFolder Copy-Item -Path $pkg -Destination $zipFileLocation Expand-Archive -Path $zipFileLocation -DestinationPath $workFolder [xml] $packageXML = Get-ChildItem -Path "$workFolder/*.nuspec" | Get-Content - if (@(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]) { - $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0] + $changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0] + if ($changeLogLoc) { + $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc } $readmeContentLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "README.md")[0] @@ -283,12 +290,14 @@ function ParsePyPIPackage($pkg, $workingDirectory) { $workFolder = "$workingDirectory$($pkg.Basename)" $origFolder = Get-Location $releaseNotes = "" + $readmeContent = "" New-Item -ItemType Directory -Force -Path $workFolder Expand-Archive -Path $pkg -DestinationPath $workFolder - if (@(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0]) { - $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0] + $changeLogLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "CHANGELOG.md")[0] + if ($changeLogLoc) { + $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc } $readmeContentLoc = @(Get-ChildItem -Path $workFolder -Recurse -Include "README.md")[0] @@ -310,10 +319,12 @@ function ParseCArtifact($pkg, $workingDirectory) { $packageInfo = Get-Content -Raw -Path $pkg | ConvertFrom-JSON $packageArtifactLocation = (Get-ItemProperty $pkg).Directory.FullName $releaseNotes = "" + $readmeContent = "" - if (@(Get-ChildItem -Path $packageArtifactLocation -Recurse -Include "CHANGELOG.md")[0]) + $changeLogLoc = @(Get-ChildItem -Path $packageArtifactLocation -Recurse -Include "CHANGELOG.md")[0] + if ($changeLogLoc) { - $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -changeLogLocation @(Get-ChildItem -Path $packageArtifactLocation -Recurse -Include "CHANGELOG.md")[0] + $releaseNotes = &"${PSScriptRoot}/../Extract-ReleaseNotes.ps1" -ChangeLogLocation $changeLogLoc } $readmeContentLoc = @(Get-ChildItem -Path $packageArtifactLocation -Recurse -Include "README.md")[0] @@ -322,14 +333,13 @@ function ParseCArtifact($pkg, $workingDirectory) { } return New-Object PSObject -Property @{ - PackageId = $packageInfo.name + PackageId = '' PackageVersion = $packageInfo.version # Artifact info is always considered deployable for C becasue it is not # deployed anywhere. Dealing with duplicate tags happens downstream in # CheckArtifactShaAgainstTagsList Deployable = $true ReleaseNotes = $releaseNotes - ReadmeContent = $readmeContent } } @@ -432,10 +442,16 @@ function VerifyPackages($pkgRepository, $artifactLocation, $workingDirectory, $a exit(1) } + $tag = if ($parsedPackage.packageId) { + "$($parsedPackage.packageId)_$($parsedPackage.PackageVersion)" + } else { + $parsedPackage.PackageVersion + } + $pkgList += New-Object PSObject -Property @{ PackageId = $parsedPackage.PackageId PackageVersion = $parsedPackage.PackageVersion - Tag = ($parsedPackage.PackageId + "_" + $parsedPackage.PackageVersion) + Tag = $tag ReleaseNotes = $parsedPackage.ReleaseNotes ReadmeContent = $parsedPackage.ReadmeContent } diff --git a/eng/common/scripts/copy-docs-to-blobstorage.ps1 b/eng/common/scripts/copy-docs-to-blobstorage.ps1 index 920bc392fa24..03e508c17cb5 100644 --- a/eng/common/scripts/copy-docs-to-blobstorage.ps1 +++ b/eng/common/scripts/copy-docs-to-blobstorage.ps1 @@ -345,14 +345,11 @@ if ($Language -eq "java") if ($Language -eq "c") { # The documentation publishing process for C differs from the other - # langauges in this file because this script is invoked once per library + # langauges in this file because this script is invoked for the whole SDK # publishing. It is not, for example, invoked once per service publishing. - # This is also the case for other langauge publishing steps above... Those - # loops are left over from previous versions of this script which were used - # to publish multiple docs packages in a single invocation. + # There is a similar situation for other langauge publishing steps above... + # Those loops are left over from previous versions of this script which were + # used to publish multiple docs packages in a single invocation. $pkgInfo = Get-Content $DocLocation/package-info.json | ConvertFrom-Json - $pkgName = $pkgInfo.name - $pkgVersion = $pkgInfo.version - - Upload-Blobs -DocDir $DocLocation -PkgName $pkgName -DocVersion $pkgVersion + Upload-Blobs -DocDir $DocLocation -PkgName 'docs' -DocVersion $pkgInfo.version } \ No newline at end of file diff --git a/eng/common/scripts/update-docs-metadata.ps1 b/eng/common/scripts/update-docs-metadata.ps1 index b4cc2ac7849e..f88717c4f714 100644 --- a/eng/common/scripts/update-docs-metadata.ps1 +++ b/eng/common/scripts/update-docs-metadata.ps1 @@ -24,19 +24,19 @@ Write-Host "> $PSCommandPath $args" function GetMetaData($lang){ switch ($lang) { "java" { - $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/releases/latest/java-packages.csv" + $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/allpackages/java-packages.csv" break } ".net" { - $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/releases/latest/dotnet-packages.csv" + $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/allpackages/dotnet-packages.csv" break } "python" { - $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/releases/latest/python-packages.csv" + $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/allpackages/python-packages.csv" break } "javascript" { - $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/releases/latest/js-packages.csv" + $metadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/allpackages/js-packages.csv" break } default { @@ -46,6 +46,8 @@ function GetMetaData($lang){ } $metadataResponse = Invoke-WebRequest-WithHandling -url $metadataUri -method "GET" | ConvertFrom-Csv + + return $metadataResponse } function GetAdjustedReadmeContent($pkgInfo, $lang){ @@ -57,10 +59,11 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){ try { $metadata = GetMetaData -lang $lang + $service = $metadata | ? { $_.Package -eq $pkgId } if ($service) { - $service = "$service," + $service = "$($service.Service)" } } catch { @@ -68,12 +71,18 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){ Write-Host "Unable to retrieve service metadata for packageId $($pkgInfo.PackageId)" } - $headerContentMatch = (Select-String -InputObject $pkgInfo.ReadmeContent -Pattern 'Azure .+? (client|plugin|shared) library for (JavaScript|Java|Python|\.NET|C)').Matches[0] + $fileContent = $pkgInfo.ReadmeContent + + # only replace the version if the formatted header can be found + $headerContentMatches = (Select-String -InputObject $pkgInfo.ReadmeContent -Pattern 'Azure .+? (client|plugin|shared) library for (JavaScript|Java|Python|\.NET|C)') + if ($headerContentMatches) { + $headerContentMatch = $headerContentMatches.Matches[0] + $header = "---`ntitle: $headerContentMatch`nkeywords: Azure, $lang, SDK, API, $($pkgInfo.PackageId), $service`nauthor: maggiepint`nms.author: magpint`nms.date: $date`nms.topic: article`nms.prod: azure`nms.technology: azure`nms.devlang: $lang`nms.service: $service`n---`n" + $fileContent = $pkgInfo.ReadmeContent -replace $headerContentMatch, "$headerContentMatch - Version $($pkgInfo.PackageVersion) `n" + } - if ($headerContentMatch){ - $header = "---`r`ntitle: $headerContentMatch`r`nkeywords: Azure, $lang, SDK, API, $service $($pkgInfo.PackageId)`r`nauthor: maggiepint`r`nms.author: magpint`r`nms.date: $date`r`nms.topic: article`r`nms.prod: azure`r`nms.technology: azure`r`nms.devlang: $lang`r`nms.service: $service`r`n---`r`n" - $fileContent = $pkgInfo.ReadmeContent -replace $headerContentMatch, "$headerContentMatch - Version $($pkgInfo.PackageVersion) `r`n" - return "$header $fileContent" + if ($fileContent) { + return "$header`n$fileContent" } else { return "" @@ -102,7 +111,10 @@ if ($pkgs) { $readmeName = "$($packageInfo.PackageId.Replace('azure-','').Replace('Azure.', '').Replace('@azure/', '').ToLower())-readme$rdSuffix.md" $readmeLocation = Join-Path $DocRepoLocation $DocRepoContentLocation $readmeName - $adjustedContent = GetAdjustedReadmeContent -pkgInfo $packageInfo -lang $Language + + if ($packageInfo.ReadmeContent) { + $adjustedContent = GetAdjustedReadmeContent -pkgInfo $packageInfo -lang $Language + } if ($adjustedContent) { try {