Skip to content

Commit a5d4eb7

Browse files
authored
Add script for local docfx build (#441)
1 parent 4a7b864 commit a5d4eb7

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Follow the steps below to run/debug locally. The optional steps take longer, but
2828
1. Optional: Only process Markdown files in `docs`:
2929

3030
```shell
31-
dotnet tool restore && dotnet docfx build docs/docfx.json --warningsAsErrors true
31+
pwsh build/docfx-build.ps1
3232
```
3333

3434
1. Open [Steeltoe.io.slnx](src/Steeltoe.io.slnx) in your preferred IDE, or run from the command line:

build/docfx-build.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env pwsh
2+
3+
set-StrictMode -Version Latest
4+
$ErrorActionPreference = 'Stop'
5+
6+
function EnsureDocfxBinaries() {
7+
# Temporary workaround until a proper DocFX build supporting .NET 10 is available.
8+
$zipFile = [IO.Path]::Combine($env:TEMP, 'docfx-net10-binaries.zip')
9+
10+
if (!(Test-Path -Path 'docfx-net10-binaries')) {
11+
Invoke-WebRequest -Uri 'https://ent.box.com/shared/static/3b9s1j71jmcsbjgug0yjel8fohk1n720.zip' -Method 'GET' -OutFile $zipFile
12+
Expand-Archive $zipFile -Force
13+
}
14+
}
15+
16+
# Get the script's directory
17+
$baseDir = Split-Path -Parent $MyInvocation.MyCommand.Path
18+
Push-Location $baseDir
19+
20+
try {
21+
EnsureDocfxBinaries
22+
23+
$buildArgs = @('exec', 'docfx-net10-binaries/docfx.dll', 'build', (Join-Path '..' 'docs' 'docfx.json'), '--warningsAsErrors', 'true')
24+
Write-Output "Running command: dotnet $buildArgs"
25+
dotnet $buildArgs
26+
}
27+
finally {
28+
Pop-Location
29+
}

0 commit comments

Comments
 (0)