Update C# API Docs #52
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
name: Update C# API Docs | |
# Run when the C# API changes or every month so that the artifact does not expire | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- csharp/** | |
schedule: | |
- cron: '0 0 1,15 * *' | |
workflow_dispatch: | |
concurrency: | |
group: "apidocs-csharp" | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Mono | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y mono-complete | |
- name: Install DocFX | |
run: | | |
dotnet tool update -g docfx | |
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH | |
# Restore project dependencies | |
- name: Restore dependencies | |
run: | | |
dotnet restore csharp/ApiDocs/ApiDocs.csproj | |
dotnet restore /p:IncludeMobileTargets=false csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj | |
- name: docfx metadata | |
run: | | |
docfx metadata csharp/ApiDocs/docfx.json | |
- name: Build ApiDocs project | |
run: | | |
dotnet build csharp/ApiDocs/ApiDocs.csproj --no-restore | |
- name: docfx build | |
run: | | |
docfx build csharp/ApiDocs/docfx.json | |
- name: Log source commit | |
run: git rev-parse --short HEAD > csharp/ApiDocs/csharp/source-version.txt | |
- name: Move C# docs into site | |
shell: pwsh | |
run: | | |
New-Item -Path _site/docs/api -Force -ItemType "Directory" | Out-Null | |
$OutputDirectory="_site/docs/api/csharp" | |
if (Test-Path $OutputDirectory) { Remove-Item -Recurse -Force $OutputDirectory } | |
Move-Item -Path csharp\ApiDocs\csharp -Destination $OutputDirectory | |
- name: Upload docs artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: onnxruntime-csharp-apidocs | |
path: _site | |
retention-days: 30 |