name: Update JS API Docs
|
|
# Run when the JS API changes or every week so that the artifact does not expire.
|
# Also runs on pull requests that touch relevant files so doc generation errors
|
# are caught early. The artifact is only published on the main branch.
|
on:
|
push:
|
branches:
|
- main
|
paths:
|
- js/common/**
|
pull_request:
|
paths:
|
- js/common/**
|
schedule:
|
- cron: '0 0 * * 0'
|
workflow_dispatch:
|
|
concurrency:
|
group: "apidocs-js-${{ github.ref }}"
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
permissions:
|
contents: write
|
|
jobs:
|
build:
|
name: Generate JS API docs
|
runs-on: [
|
"self-hosted",
|
"1ES.Pool=onnxruntime-github-Ubuntu2204-AMD-CPU",
|
"JobId=apidocs-js-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}"
|
]
|
timeout-minutes: 120
|
steps:
|
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
|
- name: Setup Node.js
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
with:
|
node-version: 24
|
- name: Generate JS docs
|
run: |
|
cd js/
|
npm ci
|
cd common/
|
npm ci
|
npx typedoc
|
- name: Log source commit
|
run: git rev-parse --short HEAD > js/common/docs/source-version.txt
|
- name: Move JS docs into site
|
run: |
|
rm -rf _site/docs/api/js
|
mkdir -p _site/docs/api
|
mv js/common/docs _site/docs/api/js
|
- name: Upload docs artifact
|
if: github.ref == 'refs/heads/main'
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
with:
|
name: onnxruntime-node-apidocs
|
path: _site
|
retention-days: 10
|