diff --git a/README.md b/README.md index 4b7024ba..8e00dc9d 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Follow the steps below to run/debug locally. The optional steps take longer, but 1. Optional: Only process Markdown files in `docs`: ```shell - dotnet tool restore && dotnet docfx build docs/docfx.json --warningsAsErrors true + pwsh build/docfx-build.ps1 ``` 1. Open [Steeltoe.io.slnx](src/Steeltoe.io.slnx) in your preferred IDE, or run from the command line: diff --git a/build/docfx-build.ps1 b/build/docfx-build.ps1 new file mode 100644 index 00000000..a10c6766 --- /dev/null +++ b/build/docfx-build.ps1 @@ -0,0 +1,29 @@ +#!/usr/bin/env pwsh + +set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +function EnsureDocfxBinaries() { + # Temporary workaround until a proper DocFX build supporting .NET 10 is available. + $zipFile = [IO.Path]::Combine($env:TEMP, 'docfx-net10-binaries.zip') + + if (!(Test-Path -Path 'docfx-net10-binaries')) { + Invoke-WebRequest -Uri 'https://ent.box.com/shared/static/3b9s1j71jmcsbjgug0yjel8fohk1n720.zip' -Method 'GET' -OutFile $zipFile + Expand-Archive $zipFile -Force + } +} + +# Get the script's directory +$baseDir = Split-Path -Parent $MyInvocation.MyCommand.Path +Push-Location $baseDir + +try { + EnsureDocfxBinaries + + $buildArgs = @('exec', 'docfx-net10-binaries/docfx.dll', 'build', (Join-Path '..' 'docs' 'docfx.json'), '--warningsAsErrors', 'true') + Write-Output "Running command: dotnet $buildArgs" + dotnet $buildArgs +} +finally { + Pop-Location +}