Update docfx tools (#184) #275
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds and publishes the documentation website | |
name: Build docs | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: Install DocLinkChecker | |
run: dotnet tool install DocLinkChecker --version 1.19.0 | |
# Check for missing / broken links in the *.md files prior to building the website | |
- name: Check Documentation Links | |
run: .\docfx-utils.ps1 -d | |
- name: Setup DocFX | |
run: dotnet tool restore | |
- name: Setup Bonsai | |
working-directory: .bonsai | |
run: .\Setup.ps1 | |
- name: Build Documentation | |
run: .\docfx-utils.ps1 -b | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: _site | |
path: _site | |
if-no-files-found: error | |
- name: Upload GitHub Pages Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: _site | |
check: | |
name: Check Links | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: _site | |
path: _site | |
- name: Restore lychee cache | |
uses: actions/cache@v4 | |
with: | |
path: .lycheecache | |
key: cache-lychee-${{ github.sha }} | |
restore-keys: cache-lychee- | |
# This checks for missing / broken links in the *.html files after building the website. | |
# We need to run this step here to check that all auto-generated API pages have valid links too. | |
- name: Check HTML Links After Building | |
uses: lycheeverse/lychee-action@v2 | |
with: | |
args: --verbose --no-progress --base _site --exclude ^https://github\.com.*merge.* --exclude ^https://github\.com.*apiSpec.* --max-retries 0 --max-concurrency 32 --cache --max-cache-age 1d '_site/**/*.html' | |
fail: true | |
deploy: | |
name: Deploy docs | |
runs-on: ubuntu-latest | |
needs: [ build, check ] | |
if: github.event_name == 'push' | |
permissions: | |
# Both required by actions/deploy-pages | |
pages: write | |
id-token: write | |
steps: | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |