You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by pa...@apache.org on 2026/06/16 19:43:28 UTC
(lucenenet) 11/23: Docs & Website: Fixed build automation in CI (Fixes #1004) (#1214)
This is an automated email from the ASF dual-hosted git repository.
paulirwin pushed a commit to branch release/4.8.0-beta00018
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit ef03bcd1df51964a4255613c6a12f4a57e7a5891
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Fri Oct 31 20:08:22 2025 +0700
Docs & Website: Fixed build automation in CI (Fixes #1004) (#1214)
* websites/apidocs/docs.ps1: Use Set-Location to ensure dotnet tool commands are run from the repo root in CI
* websites/site/site.ps1: Use Set-Location to ensure dotnet tool commands are run in the repo root in CI
* .github/workflows (Lucene-Net-Documentation.yml + Lucene.Net.Website.yml): Updated actions tasks to the latest version
---
.github/workflows/Lucene-Net-Documentation.yml | 8 ++--
.github/workflows/Lucene-Net-Website.yml | 6 +--
websites/apidocs/docs.ps1 | 50 ++++++++++++++------
websites/site/site.ps1 | 65 +++++++++++++++-----------
4 files changed, 80 insertions(+), 49 deletions(-)
diff --git a/.github/workflows/Lucene-Net-Documentation.yml b/.github/workflows/Lucene-Net-Documentation.yml
index 809735652..6746cb706 100644
--- a/.github/workflows/Lucene-Net-Documentation.yml
+++ b/.github/workflows/Lucene-Net-Documentation.yml
@@ -57,7 +57,7 @@ jobs:
# Checkout the main repo with all history so we get all tags
- name: Checkout Lucene.Net source
- uses: actions/checkout@v3
+ uses: actions/checkout@v5
with:
path: main-repo
fetch-depth: 0
@@ -119,12 +119,12 @@ jobs:
shell: powershell
- name: Setup .NET 6 SDK
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v5
with:
dotnet-version: '6.0.x'
- name: Setup .NET 8 SDK
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v5
with:
dotnet-version: '8.0.x'
@@ -133,7 +133,7 @@ jobs:
shell: powershell
- name: Checkout Lucene.Net website
- uses: actions/checkout@v3
+ uses: actions/checkout@v5
with:
repository: ${{ env.SITE_REPO }}
ref: asf-site
diff --git a/.github/workflows/Lucene-Net-Website.yml b/.github/workflows/Lucene-Net-Website.yml
index 76346b2f8..5e9a64056 100644
--- a/.github/workflows/Lucene-Net-Website.yml
+++ b/.github/workflows/Lucene-Net-Website.yml
@@ -50,7 +50,7 @@ jobs:
# Checkout the main repo with all history so we get all tags
- name: Checkout Lucene.Net source
- uses: actions/checkout@v3
+ uses: actions/checkout@v5
with:
path: main-repo
fetch-depth: 0
@@ -106,14 +106,14 @@ jobs:
shell: powershell
- name: Upload website as build artifact
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v5
if: ${{always()}}
with:
name: 'website'
path: '${{github.workspace}}/main-repo/websites/site/_site'
- name: Checkout Lucene.Net website
- uses: actions/checkout@v3
+ uses: actions/checkout@v5
with:
repository: ${{ env.SITE_REPO }}
ref: asf-site
diff --git a/websites/apidocs/docs.ps1 b/websites/apidocs/docs.ps1
index 7c3fecd18..80bbbddfa 100644
--- a/websites/apidocs/docs.ps1
+++ b/websites/apidocs/docs.ps1
@@ -66,8 +66,12 @@ $BreadcrumbPath = Join-Path -Path $ApiDocsFolder -ChildPath "docfx.global.subsit
Write-Host "Restoring docfx tool..."
$PreviousLocation = Get-Location
Set-Location $RepoRoot
-dotnet tool restore
-Set-Location $PreviousLocation
+try {
+ dotnet tool restore
+} finally {
+ Set-Location $PreviousLocation
+}
+
# delete anything that already exists
if ($Clean) {
@@ -155,7 +159,13 @@ if ($? -and $DisableMetaData -eq $false) {
# build the output
Write-Host "Building api metadata for $projFile..."
- & dotnet tool run docfx metadata $projFile --log "$DocFxLog" --logLevel $LogLevel
+ $PreviousLocation = Get-Location
+ Set-Location $RepoRoot
+ try {
+ & dotnet tool run docfx metadata $projFile --log "$DocFxLog" --logLevel $LogLevel
+ } finally {
+ Set-Location $PreviousLocation
+ }
}
}
@@ -183,7 +193,13 @@ if ($? -and $DisableBuild -eq $false) {
# build the output
Write-Host "Building site output for $projFile..."
- & dotnet tool run docfx build $projFile --log "$DocFxLog" --logLevel $LogLevel --debug --maxParallelism 1
+ $PreviousLocation = Get-Location
+ Set-Location $RepoRoot
+ try {
+ & dotnet tool run docfx build $projFile --log "$DocFxLog" --logLevel $LogLevel --debug --maxParallelism 1
+ } finally {
+ Set-Location $PreviousLocation
+ }
# Add the baseUrl to the output xrefmap, see https://github.com/dotnet/docfx/issues/2346#issuecomment-356054027
$projFileJson = Get-Content $projFile | ConvertFrom-Json
@@ -201,16 +217,22 @@ if ($? -and $DisableBuild -eq $false) {
if ($?) {
$DocFxLog = Join-Path -Path $ApiDocsFolder "obj\docfx.site.json.log"
- if ($ServeDocs -eq $false) {
-
- # build the output
- Write-Host "Building docs..."
- & dotnet tool run docfx $DocFxJsonSite --log "$DocFxLog" --logLevel $LogLevel --debug --maxParallelism 1
- }
- else {
- # build + serve (for testing)
- Write-Host "starting website..."
- & dotnet tool run docfx $DocFxJsonSite --log "$DocFxLog" --logLevel $LogLevel --serve --port $StagingPort --debug --maxParallelism 1
+ $PreviousLocation = Get-Location
+ Set-Location $RepoRoot
+ try {
+ if ($ServeDocs -eq $false) {
+
+ # build the output
+ Write-Host "Building docs..."
+ & dotnet tool run docfx $DocFxJsonSite --log "$DocFxLog" --logLevel $LogLevel --debug --maxParallelism 1
+ }
+ else {
+ # build + serve (for testing)
+ Write-Host "starting website..."
+ & dotnet tool run docfx $DocFxJsonSite --log "$DocFxLog" --logLevel $LogLevel --serve --port $StagingPort --debug --maxParallelism 1
+ }
+ } finally {
+ Set-Location $PreviousLocation
}
}
diff --git a/websites/site/site.ps1 b/websites/site/site.ps1
index dfff06872..4c1e3d4b2 100644
--- a/websites/site/site.ps1
+++ b/websites/site/site.ps1
@@ -18,15 +18,15 @@
# -----------------------------------------------------------------------------------
param (
- [switch] $ServeDocs = $false,
- [switch] $Clean = $false,
- # LogLevel can be: Diagnostic, Verbose, Info, Warning, Error
- [Parameter(Mandatory=$false)]
- [string]
- $LogLevel = 'Info',
- [Parameter(Mandatory=$false)]
- [int]
- $StagingPort = 8081
+ [switch] $ServeDocs = $false,
+ [switch] $Clean = $false,
+ # LogLevel can be: Diagnostic, Verbose, Info, Warning, Error
+ [Parameter(Mandatory=$false)]
+ [string]
+ $LogLevel = 'Info',
+ [Parameter(Mandatory=$false)]
+ [int]
+ $StagingPort = 8081
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
@@ -39,37 +39,46 @@ $ToolsFolder = Join-Path -Path $SiteFolder -ChildPath "tools";
New-Item $ToolsFolder -type directory -force
if ($Clean) {
- Write-Host "Cleaning tools..."
- Remove-Item (Join-Path -Path $ToolsFolder "\*") -recurse -force -ErrorAction SilentlyContinue
+ Write-Host "Cleaning tools..."
+ Remove-Item (Join-Path -Path $ToolsFolder "\*") -recurse -force -ErrorAction SilentlyContinue
}
# install docfx tool
$PreviousLocation = Get-Location
Set-Location $RepoRoot
-dotnet tool restore
-Set-Location $PreviousLocation
+try {
+ dotnet tool restore
+} finally {
+ Set-Location $PreviousLocation
+}
# delete anything that already exists
if ($Clean) {
- Write-Host "Cleaning..."
- Remove-Item (Join-Path -Path $SiteFolder "_site\*") -recurse -force -ErrorAction SilentlyContinue
- Remove-Item (Join-Path -Path $SiteFolder "_site") -force -ErrorAction SilentlyContinue
- Remove-Item (Join-Path -Path $SiteFolder "obj\*") -recurse -force -ErrorAction SilentlyContinue
- Remove-Item (Join-Path -Path $SiteFolder "obj") -force -ErrorAction SilentlyContinue
+ Write-Host "Cleaning..."
+ Remove-Item (Join-Path -Path $SiteFolder "_site\*") -recurse -force -ErrorAction SilentlyContinue
+ Remove-Item (Join-Path -Path $SiteFolder "_site") -force -ErrorAction SilentlyContinue
+ Remove-Item (Join-Path -Path $SiteFolder "obj\*") -recurse -force -ErrorAction SilentlyContinue
+ Remove-Item (Join-Path -Path $SiteFolder "obj") -force -ErrorAction SilentlyContinue
}
$DocFxJson = Join-Path -Path $SiteFolder "docfx.json"
$DocFxLog = Join-Path -Path $SiteFolder "obj\docfx.log"
if($?) {
- if ($ServeDocs -eq $false) {
- # build the output
- Write-Host "Building docs..."
- & dotnet tool run docfx build $DocFxJson -l "$DocFxLog" --logLevel $LogLevel
- }
- else {
- # build + serve (for testing)
- Write-Host "starting website..."
- & dotnet tool run docfx $DocFxJson --serve --port $StagingPort
- }
+ $PreviousLocation = Get-Location
+ Set-Location $RepoRoot
+ try {
+ if ($ServeDocs -eq $false) {
+ # build the output
+ Write-Host "Building docs..."
+ & dotnet tool run docfx build $DocFxJson -l "$DocFxLog" --logLevel $LogLevel
+ }
+ else {
+ # build + serve (for testing)
+ Write-Host "starting website..."
+ & dotnet tool run docfx $DocFxJson --serve --port $StagingPort
+ }
+ } finally {
+ Set-Location $PreviousLocation
+ }
}