From 87ab44cdf70cd20c7a12e0e165d60e05369b9c81 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Fri, 20 Nov 2020 10:49:59 -0800 Subject: [PATCH 1/9] Fixed the docindex.yml and rename the files --- eng/common/docgeneration/Generate-DocIndex.ps1 | 2 +- eng/common/pipelines/templates/steps/docindex.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 84fd56271550..e2691e604f07 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -162,7 +162,7 @@ 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, diff --git a/eng/common/pipelines/templates/steps/docindex.yml b/eng/common/pipelines/templates/steps/docindex.yml index 002c009bc6a3..38462c45435e 100644 --- a/eng/common/pipelines/templates/steps/docindex.yml +++ b/eng/common/pipelines/templates/steps/docindex.yml @@ -1,7 +1,5 @@ jobs: - job: CreateDocIndex - variables: - - template: templates/variables/globals.yml pool: vmImage: windows-2019 steps: @@ -49,6 +47,7 @@ jobs: targetPath: $(Build.ArtifactStagingDirectory)/docfx_project/_site - pwsh: | + git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit -am "Save the language updates." git checkout -b gh-pages-local --track origin/gh-pages-root workingDirectory: $(Build.SourcesDirectory) displayName: Git pull GH pages branch From dddeb7dc2171a5d4d5e8d736592eff40816e95ce Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Fri, 20 Nov 2020 11:45:13 -0800 Subject: [PATCH 2/9] Reset the mutated changes --- eng/common/pipelines/templates/steps/docindex.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/pipelines/templates/steps/docindex.yml b/eng/common/pipelines/templates/steps/docindex.yml index 38462c45435e..c5c54af0c431 100644 --- a/eng/common/pipelines/templates/steps/docindex.yml +++ b/eng/common/pipelines/templates/steps/docindex.yml @@ -47,7 +47,7 @@ jobs: targetPath: $(Build.ArtifactStagingDirectory)/docfx_project/_site - pwsh: | - git -c user.name=`"azure-sdk`" -c user.email=`"azuresdk@microsoft.com`" commit -am "Save the language updates." + git reset --hard HEAD git checkout -b gh-pages-local --track origin/gh-pages-root workingDirectory: $(Build.SourcesDirectory) displayName: Git pull GH pages branch From 3eddefcd1b5f7f12a8b27fb4bb86deb0363141ec Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Fri, 20 Nov 2020 11:52:31 -0800 Subject: [PATCH 3/9] Force checkout as the changes have already copied out --- eng/common/pipelines/templates/steps/docindex.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/common/pipelines/templates/steps/docindex.yml b/eng/common/pipelines/templates/steps/docindex.yml index c5c54af0c431..488c835a8289 100644 --- a/eng/common/pipelines/templates/steps/docindex.yml +++ b/eng/common/pipelines/templates/steps/docindex.yml @@ -47,8 +47,7 @@ jobs: targetPath: $(Build.ArtifactStagingDirectory)/docfx_project/_site - pwsh: | - git reset --hard HEAD - 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 From 89b199c73d4c802a07b6b4114a3b9c899a8cb7a0 Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Fri, 20 Nov 2020 15:25:28 -0800 Subject: [PATCH 4/9] Minor changes for parameters --- eng/common/docgeneration/Generate-DocIndex.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index e2691e604f07..55b639cd54f0 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -119,7 +119,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] @@ -164,7 +164,7 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { function UpdateDocIndexFiles { Param ( - [Parameter(Mandatory=$true)] [String]$appTitle, + [Parameter(Mandatory=$true)] [String]$appTitleLang, [Parameter(Mandatory=$true)] [String]$lang, [Parameter(Mandatory=$true)] [String]$indexhtmlloc, [Parameter(Mandatory=$false)] [String]$packageRegex = "`"`"", @@ -172,8 +172,8 @@ function UpdateDocIndexFiles { ) # 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 From 5182d92060d220ca4d6544d4d3ff6ba1e5b4a00a Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Mon, 23 Nov 2020 10:38:40 -0800 Subject: [PATCH 5/9] Update Generate-DocIndex.ps1 --- eng/common/docgeneration/Generate-DocIndex.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 55b639cd54f0..65cc4a588bb2 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -165,8 +165,8 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { function UpdateDocIndexFiles { Param ( [Parameter(Mandatory=$true)] [String]$appTitleLang, - [Parameter(Mandatory=$true)] [String]$lang, - [Parameter(Mandatory=$true)] [String]$indexhtmlloc, + [Parameter(Mandatory=$true)] [String]$lang = $Language, + [Parameter(Mandatory=$true)] [String]$indexhtmlloc="index.html", [Parameter(Mandatory=$false)] [String]$packageRegex = "`"`"", [Parameter(Mandatory=$false)] [String]$regexReplacement = "" ) From 6b5f8bdb2177782718c9b90aec75fae6db4d683f Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Mon, 23 Nov 2020 11:37:14 -0800 Subject: [PATCH 6/9] Update Generate-DocIndex.ps1 --- eng/common/docgeneration/Generate-DocIndex.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 65cc4a588bb2..13ef3e53b0ff 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -164,9 +164,9 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang) { function UpdateDocIndexFiles { Param ( - [Parameter(Mandatory=$true)] [String]$appTitleLang, - [Parameter(Mandatory=$true)] [String]$lang = $Language, - [Parameter(Mandatory=$true)] [String]$indexhtmlloc="index.html", + [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 = "" ) From 7a1c185ca8d31a49d0ec432ba89b1aea935f7db2 Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Mon, 23 Nov 2020 12:16:58 -0800 Subject: [PATCH 7/9] Update Generate-DocIndex.ps1 --- eng/common/docgeneration/Generate-DocIndex.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 13ef3e53b0ff..3c15a4c338fb 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -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. From 976950c60826193d2ac15cbf6c5447f0905b530f Mon Sep 17 00:00:00 2001 From: Sima Zhu Date: Mon, 23 Nov 2020 12:58:48 -0800 Subject: [PATCH 8/9] Added function to common --- eng/common/docgeneration/Generate-DocIndex.ps1 | 2 +- eng/common/scripts/common.ps1 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 3c15a4c338fb..5d981de3cb45 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -191,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." } diff --git a/eng/common/scripts/common.ps1 b/eng/common/scripts/common.ps1 index e9a4e0709993..fd9f40637d05 100644 --- a/eng/common/scripts/common.ps1 +++ b/eng/common/scripts/common.ps1 @@ -33,4 +33,5 @@ if (-not $LanguageShort) $GetPackageInfoFromRepoFn = "Get-${Language}-PackageInfoFromRepo" $GetPackageInfoFromPackageFileFn = "Get-${Language}-PackageInfoFromPackageFile" $PublishGithubIODocsFn = "Publish-${Language}-GithubIODocs" -$UpdateDocCIFn = "Update-${Language}-CIConfig" \ No newline at end of file +$UpdateDocCIFn = "Update-${Language}-CIConfig" +$GetGithubIoDocIndexFn = "Get-${Language}-GithubIoDocIndex" \ No newline at end of file From 6ae19f805bca791287f29a13630339107106440d Mon Sep 17 00:00:00 2001 From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Date: Mon, 23 Nov 2020 13:17:21 -0800 Subject: [PATCH 9/9] Update Generate-DocIndex.ps1 --- eng/common/docgeneration/Generate-DocIndex.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/docgeneration/Generate-DocIndex.ps1 b/eng/common/docgeneration/Generate-DocIndex.ps1 index 5d981de3cb45..cb7b1051473b 100644 --- a/eng/common/docgeneration/Generate-DocIndex.ps1 +++ b/eng/common/docgeneration/Generate-DocIndex.ps1 @@ -165,7 +165,7 @@ function UpdateDocIndexFiles { Param ( [Parameter(Mandatory=$false)] [String]$appTitleLang = $Language, [Parameter(Mandatory=$false)] [String]$lang = $Language, - [Parameter(Mandatory=$false)] [String]$indexhtmlloc="index.html", + [Parameter(Mandatory=$false)] [String]$indexhtmlloc = "index.html", [Parameter(Mandatory=$false)] [String]$packageRegex = "`"`"", [Parameter(Mandatory=$false)] [String]$regexReplacement = "" )