Sync eng/common directory with azure-sdk-tools for PR 1226 (#1012)
* Fixed the docindex.yml and rename the files * Reset the mutated changes * Force checkout as the changes have already copied out * Minor changes for parameters * Update Generate-DocIndex.ps1 * Update Generate-DocIndex.ps1 * Update Generate-DocIndex.ps1 * Added function to common * Update Generate-DocIndex.ps1 Co-authored-by: Sima Zhu <sizhu@microsoft.com> Co-authored-by: Sima Zhu <48036328+sima-zhu@users.noreply.github.com>
This commit is contained in:
parent
7c8d40bddf
commit
6a2eeb8e83
@ -9,7 +9,6 @@ Param (
|
||||
$MainJsPath = "${PSScriptRoot}\templates\matthews\styles\main.js"
|
||||
)
|
||||
. "${PSScriptRoot}\..\scripts\common.ps1"
|
||||
$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex"
|
||||
|
||||
# Given the metadata url under https://github.com/Azure/azure-sdk/tree/master/_data/releases/latest,
|
||||
# the function will return the csv metadata back as part of response.
|
||||
@ -119,7 +118,7 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) {
|
||||
New-Item -Path $YmlPath -Name "toc.yml" -Force
|
||||
$visitedService = @{}
|
||||
# Sort and display toc service name by alphabetical order, and then sort artifact by order.
|
||||
foreach ($serviceMapping in ($tocContent.GetEnumerator() | Sort-Object Value[0], Key)) {
|
||||
foreach ($serviceMapping in ($tocContent.GetEnumerator() | Sort-Object Value, Key)) {
|
||||
$artifact = $serviceMapping.Key
|
||||
$serviceName = $serviceMapping.Value[0]
|
||||
$displayName = $serviceMapping.Value[1]
|
||||
@ -162,18 +161,18 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) {
|
||||
Copy-Item "${DocGenDir}/assets/logo.svg" -Destination "${DocOutDir}/_site/" -Force
|
||||
}
|
||||
|
||||
function Mutate-Files {
|
||||
function UpdateDocIndexFiles {
|
||||
Param (
|
||||
[Parameter(Mandatory=$true)] [String]$appTitle,
|
||||
[Parameter(Mandatory=$true)] [String]$lang,
|
||||
[Parameter(Mandatory=$true)] [String]$indexhtmlloc,
|
||||
[Parameter(Mandatory=$false)] [String]$appTitleLang = $Language,
|
||||
[Parameter(Mandatory=$false)] [String]$lang = $Language,
|
||||
[Parameter(Mandatory=$false)] [String]$indexhtmlloc = "index.html",
|
||||
[Parameter(Mandatory=$false)] [String]$packageRegex = "`"`"",
|
||||
[Parameter(Mandatory=$false)] [String]$regexReplacement = ""
|
||||
)
|
||||
# Update docfx.json
|
||||
$docfxContent = Get-Content -Path $DocfxJsonPath -Raw
|
||||
$docfxContent = $docfxContent -replace "`"_appTitle`": `"`"", "`"_appTitle`": `"$appTitle`""
|
||||
$docfxContent = $docfxContent -replace "`"_appFooter`": `"`"", "`"_appFooter`": `"$appTitle`""
|
||||
$docfxContent = $docfxContent -replace "`"_appTitle`": `"`"", "`"_appTitle`": `"Azure SDK for $appTitleLang`""
|
||||
$docfxContent = $docfxContent -replace "`"_appFooter`": `"`"", "`"_appFooter`": `"Azure SDK for $appTitleLang`""
|
||||
Set-Content -Path $DocfxJsonPath -Value $docfxContent
|
||||
# Update main.js var lang
|
||||
$mainJsContent = Get-Content -Path $MainJsPath -Raw
|
||||
@ -192,5 +191,5 @@ if ($GetGithubIoDocIndexFn -and (Test-Path "function:$GetGithubIoDocIndexFn"))
|
||||
}
|
||||
else
|
||||
{
|
||||
LogWarning "The function '$GetGithubIoDocIndexFn' was not found."
|
||||
LogWarning "The function 'GetGithubIoDocIndexFn' was not found."
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
jobs:
|
||||
- job: CreateDocIndex
|
||||
variables:
|
||||
- template: templates/variables/globals.yml
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
steps:
|
||||
@ -49,7 +47,7 @@ jobs:
|
||||
targetPath: $(Build.ArtifactStagingDirectory)/docfx_project/_site
|
||||
|
||||
- pwsh: |
|
||||
git checkout -b gh-pages-local --track origin/gh-pages-root
|
||||
git checkout -b gh-pages-local --track origin/gh-pages-root -f
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
displayName: Git pull GH pages branch
|
||||
|
||||
|
||||
@ -33,4 +33,5 @@ if (-not $LanguageShort)
|
||||
$GetPackageInfoFromRepoFn = "Get-${Language}-PackageInfoFromRepo"
|
||||
$GetPackageInfoFromPackageFileFn = "Get-${Language}-PackageInfoFromPackageFile"
|
||||
$PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs"
|
||||
$UpdateDocCIFn = "Update-${Language}-CIConfig"
|
||||
$UpdateDocCIFn = "Update-${Language}-CIConfig"
|
||||
$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex"
|
||||
Loading…
Reference in New Issue
Block a user