Skip to content

docs: update docfx Github Action #79

docs: update docfx Github Action

docs: update docfx Github Action #79

Workflow file for this run

name: Create Documentation Pages
on:
push:
branches:
- prod
- build-docs
jobs:
build_docs:
runs-on: ubuntu-latest
name: Builds documentation and publishes to GitHub Pages
steps:
# Checkout repo
- uses: actions/checkout@v3
name: Checkout repo
# Install NuGet
- uses: nuget/setup-nuget@v1
name: Install NuGet
# Install NuGet dependencies
- name: Install NuGet dependencies
run: nuget restore JotunnLib.sln
# Needed so csproj can load correctly, isn't actually used
- name: Set references to DLLs
run: |
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"><PropertyGroup><VALHEIM_INSTALL>$HOME/VHINSTALL/</VALHEIM_INSTALL></PropertyGroup></Project>" > Environment.props
# Build docs
- uses: nunit/docfx-action@v2.6.0
name: Build documentation
with:
args: JotunnLib/docfx.json
# Build docs again so cref is resolved
- uses: nikeee/docfx-action@v1.0.0
name: Build documentation again with crefs
with:
args: JotunnLib/docfx.json
# Fix permissions on DocFX output (should not be owned by root!)
# See https://github.com/nikeee/docfx-action/issues/13
- name: Fix DocFX output permissions
run: |
sudo chown -R "$UID" JotunnLib/_site
# Patch broken docfx JavaScript that fails to parse query params for tabs
- name: Patch DocFX JavaScript bugs
run: |
sed -e "s/queryString = ''/queryString = location.search/" -i.orig JotunnLib/_site/styles/docfx.js
# Publish generated site using GitHub Pages
- uses: maxheld83/ghpages@master
name: Publish documentation to GitHub Pages
env:
BUILD_DIR: JotunnLib/_site # docfx's default output directory is _site
GH_PAT: ${{ secrets.GH_PAT }} # See https://github.com/maxheld83/ghpages