From 318db118092638f76dad1ea3d934a1267df7f68e 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 6fef6cff547db21c2b49a9dfebe7bf5332090022 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 aad99664e1c5dfcb1fc98704b94726fb97adea64 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 733a0ed3ef671d3e31f35343263a64d0f4915620 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 e94029a8d7b5304e583df9ed3b05aef84c4c3efa 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 94080741995a5e13024853a02643f30d17527646 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 76abb81bc7ff1fecfe35a00a7a8c0ec8dfff9a3e 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 ece6c3ef42783c258393098636b9e655410f011f 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 eb649cc83861787dc2e947fc49c4f7ece7e7c145 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 = "" )