Skip to content

Commit

Permalink
Update from latest PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljurek authored and azure-sdk committed Jun 29, 2021
1 parent ce98121 commit 052c838
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
- name: Artifacts
- name: PackageInfoLocations
type: object
default: []
- name: RepoId
Expand Down Expand Up @@ -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 }}'
Expand Down
19 changes: 12 additions & 7 deletions eng/common/scripts/Update-DocsMsMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = @"
---
Expand Down Expand Up @@ -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) {
Expand All @@ -116,8 +123,6 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation) {
}

$docsMsMetadata = &$GetDocsMsMetadataForPackageFn $packageInfo
$version = [AzureEngSemanticVersion]::ParseVersionString($packageInfo.Version)

$readMePath = $docsMsMetadata.LatestReadMeLocation
if ($originalVersion.IsPrerelease) {
$readMePath = $docsMsMetadata.PreviewReadMeLocation
Expand Down
2 changes: 1 addition & 1 deletion eng/common/scripts/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 052c838

Please sign in to comment.