diff --git a/eng/common/pipelines/templates/steps/update-docsms-metadata.yml b/eng/common/pipelines/templates/steps/update-docsms-metadata.yml index b230e8ebe0c92..341169b373484 100644 --- a/eng/common/pipelines/templates/steps/update-docsms-metadata.yml +++ b/eng/common/pipelines/templates/steps/update-docsms-metadata.yml @@ -1,5 +1,5 @@ parameters: - - name: Artifacts + - name: PackageInfoLocations type: object default: [] - name: RepoId @@ -75,10 +75,10 @@ steps: DefaultBranchVariableName: TargetBranchName - pwsh: | - $artifactInfoJson = '${{ convertToJson(parameters.Artifacts) }}'.Trim('"') - $artifactInfo = ConvertFrom-Json $artifactInfoJson + $packageInfoJson = '${{ convertToJson(parameters.PackageInfoLocations) }}'.Trim('"') + $packageInfoLocations = ConvertFrom-Json $packageInfoJson ${{ parameters.ScriptDirectory }}/Update-DocsMsMetadata.ps1 ` - -PackageInfoJsonLocations $artifactInfo ` + -PackageInfoJsonLocations $packageInfoLocations ` -DocRepoLocation "$(DocRepoLocation)" ` -Language '${{parameters.Language}}' ` -RepoId '${{ parameters.RepoId }}' diff --git a/eng/common/scripts/Update-DocsMsMetadata.ps1 b/eng/common/scripts/Update-DocsMsMetadata.ps1 index 389a9f7f868ee..2a9d4f26a999c 100644 --- a/eng/common/scripts/Update-DocsMsMetadata.ps1 +++ b/eng/common/scripts/Update-DocsMsMetadata.ps1 @@ -65,8 +65,11 @@ function GetAdjustedReadmeContent($ReadmeContent, $PackageInfo, $PackageMetadata $foundTitle = $matches["filetitle"] } - $replacementPattern = "`${1}$tag" - $ReadmeContent = $ReadmeContent -replace $releaseReplaceRegex, $replacementPattern + # If this is not a daily dev package, perform link replacement + if (!$packageInfo.DevVersion) { + $replacementPattern = "`${1}$tag" + $ReadmeContent = $ReadmeContent -replace $releaseReplaceRegex, $replacementPattern + } $header = @" --- @@ -96,12 +99,16 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation) { # If the package is of a dev version there may be language-specific needs to # specify the appropriate version. For example, in the case of JS, the dev # version is always 'dev' when interacting with NPM. - if ($GetDocsMsLanguageSpecificPackageInfo -and (Test-Path "Function:$GetDocsMsLanguageSpecificPackageInfo")) { - $packageInfo = &$GetDocsMsLanguageSpecificPackageInfo $packageInfo + if ($GetDocsMsDevLanguageSpecificPackageInfoFn -and (Test-Path "Function:$GetDocsMsDevLanguageSpecificPackageInfoFn")) { + $packageInfo = &$GetDocsMsDevLanguageSpecificPackageInfoFn $packageInfo + } else { + # Default: use the dev version from package info as the version for + # downstream processes + $packageInfo.Version = $packageInfo.DevVersion } } - $packageMetadataArray = (Get-CSVMetadata).Where({ $_.Package -eq $packageInfo.Name }) + $packageMetadataArray = (Get-CSVMetadata).Where({ $_.Package -eq $packageInfo.Name -and $_.GroupId -eq $packageInfo.Group -and $_.Hide -ne 'true' -and $_.New -eq 'true' }) if ($packageMetadataArray.Count -eq 0) { LogError "Could not retrieve metadata for $($packageInfo.Name) from metadata CSV" } elseif ($packageMetadataArray.Count -gt 1) { @@ -116,8 +123,6 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation) { } $docsMsMetadata = &$GetDocsMsMetadataForPackageFn $packageInfo - $version = [AzureEngSemanticVersion]::ParseVersionString($packageInfo.Version) - $readMePath = $docsMsMetadata.LatestReadMeLocation if ($originalVersion.IsPrerelease) { $readMePath = $docsMsMetadata.PreviewReadMeLocation diff --git a/eng/common/scripts/common.ps1 b/eng/common/scripts/common.ps1 index 97251158c74ff..4e0b0847cdbf1 100644 --- a/eng/common/scripts/common.ps1 +++ b/eng/common/scripts/common.ps1 @@ -41,6 +41,6 @@ $GetPackageInfoFromPackageFileFn = "Get-${Language}-PackageInfoFromPackageFile" $PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs" $UpdateDocsMsPackagesFn = "Update-${Language}-DocsMsPackages" $GetDocsMsMetadataForPackageFn = "Get-${Language}-DocsMsMetadataForPackage" -$GetDocsMsLanguageSpecificPackageInfo = "Get-${Language}-DocsMsLanguageSpecificPackageInfo" +$GetDocsMsDevLanguageSpecificPackageInfoFn = "Get-${Language}-DocsMsDevLanguageSpecificPackageInfo" $GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex" $FindArtifactForApiReviewFn = "Find-${Language}-Artifacts-For-Apireview"