This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch fix/apidocs-automation
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/fix/apidocs-automation by this 
push:
     new 245969591 docs.ps1: Install and run docfx with explicit tool path
245969591 is described below

commit 245969591a4f72e136828c13aabc514b2d265c1b
Author: Shad Storhaug <[email protected]>
AuthorDate: Thu Oct 24 10:10:07 2024 +0700

    docs.ps1: Install and run docfx with explicit tool path
---
 websites/apidocs/docs.ps1 | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/websites/apidocs/docs.ps1 b/websites/apidocs/docs.ps1
index f112bbfc5..9bafcf4ac 100644
--- a/websites/apidocs/docs.ps1
+++ b/websites/apidocs/docs.ps1
@@ -64,6 +64,8 @@ $BreadcrumbPath = Join-Path -Path $ApiDocsFolder -ChildPath 
"docfx.global.subsit
 
 # The default local tools directory
 $InstallDir = "$RepoRoot/.dotnet/tools"
+$DocFxVersion = "2.77.0"
+$VersionedInstallDir = "$InstallDir/docfx/$DocFxVersion"
 
 # install docfx tool
 $PreviousLocation = Get-Location
@@ -71,26 +73,17 @@ Set-Location $RepoRoot
 
 
 # Ensure docfx is installed
-if (-not (Test-Path "$InstallDir/docfx")) {
-    Write-Host "docfx is not installed. Installing as a local tool..."
+if (-not (Test-Path "$VersionedInstallDir")) {
+    Write-Host "docfx $DocFxVersion is not installed. Installing as a local 
tool..."
     
     # Install docfx as a local tool if it isn't listed in dotnet-tools.json
-    dotnet tool install --local docfx
-} else {
-    Write-Host "docfx is already installed. Restoring tools..."
-
-    # Restore local tools listed in dotnet-tools.json
-    dotnet tool restore
+    dotnet tool install --local docfx --tool-path "$VersionedInstallDir"
 }
-
-# Verify that docfx is accessible
-docfx --version
-
 Set-Location $PreviousLocation
 
-&dotnet tool list --local
-dotnet tool list --global
-
+& dotnet tool list --local
+# Verify that docfx is accessible
+& "$VersionedInstallDir/docfx" --version
 
 # delete anything that already exists
 if ($Clean) {

Reply via email to