mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-18 01:54:05 +00:00
### Description When API docs workflows fail, we typically don't catch the issue until the most recently generated artifact expires. The current artifact retention is 60 days, so by decreasing to 30 days, we can ensure that we're resolving the workflow failures more quickly. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
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 * *'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: "apidocs-csharp"
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCFXVERSION: 2.62.2
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
- name: Install DocFX
|
|
run: |
|
|
dotnet tool update -g docfx
|
|
# NOTE: We need to restore Microsoft.ML.OnnxRuntime.csproj manually to set IncludeMobileTargets=false
|
|
# docfx doesn't seem to be able to do that properly resulting in build errors
|
|
- 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
|
|
run: |
|
|
mkdir -p _site/docs/api
|
|
rm -rf _site/docs/api/csharp
|
|
mv csharp/ApiDocs/csharp _site/docs/api/csharp
|
|
- name: Upload docs artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: onnxruntime-csharp-apidocs
|
|
path: _site
|
|
retention-days: 30
|