paulirwin commented on code in PR #961:
URL: https://github.com/apache/lucenenet/pull/961#discussion_r1770623856
##########
websites/site/site.ps1:
##########
@@ -43,21 +45,27 @@ if ($Clean) {
Remove-Item (Join-Path -Path $ToolsFolder "\*") -recurse -force
-ErrorAction SilentlyContinue
}
-New-Item "$ToolsFolder\tmp" -type directory -force
+# install docfx tool
+$InstallDocFx = $false
+try {
+ $InstalledDocFxVersion = (& docfx --version).Trim().Split('+')[0]
-# Go get docfx.exe if we don't have it
-New-Item "$ToolsFolder\docfx" -type directory -force
-$DocFxExe = "$ToolsFolder\docfx\docfx.exe"
-if (-not (test-path $DocFxExe))
-{
- Write-Host "Retrieving docfx..."
- $DocFxZip = "$ToolsFolder\tmp\docfx.zip"
- Invoke-WebRequest
"https://github.com/dotnet/docfx/releases/download/v2.58/docfx.zip" -OutFile
$DocFxZip -TimeoutSec 60
- #unzip
- Expand-Archive $DocFxZip -DestinationPath (Join-Path -Path $ToolsFolder
-ChildPath "docfx")
+ if ([version]$InstalledDocFxVersion -lt [version]$DocFxVersion) {
+ Write-Host "DocFx is installed, but the version is less than
$DocFxVersion, will install it."
+ $InstallDocFx = $true
+ }
+ else {
+ Write-Host "DocFx is installed and the version is
$InstalledDocFxVersion."
+ }
+} catch {
+ Write-Host "DocFx is not installed or not in the PATH, will install it."
+ $InstallDocFx = $true
}
- Remove-Item -Recurse -Force "$ToolsFolder\tmp"
+if ($InstallDocFx -eq $true) {
+ Write-Host "Installing docfx global tool..."
+ dotnet tool install -g docfx --version $DocFxVersion
Review Comment:
I have used `dotnet tool install -g` in various CI builds on GitHub and
Azure DevOps and never had an issue. It is installed "globally" for the user,
not requiring admin permissions or anything like that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]