onnxruntime/.github/workflows/publish-java-apidocs.yml
Nat Kershaw (MSFT) a5d814008c
Fix API docs deploy so that a PR is not required (#15011)
Fixes this
[issue](https://github.com/microsoft/onnxruntime/actions/runs/4387534694/jobs/7682945415#step:12:534)
and removes the extra PR step in the workflow.

Also logs the commit of the main branch that the docs were generated
from to a file called version.txt at the root of the API docs tree.

Tested for Java API docs and results staged here:
https://natke.github.io/onnxruntime/docs/api/java/index.html

If approved, I can migrate all of the other API docs generation
workflows to use this scheme.
2023-03-13 09:36:08 -07:00

45 lines
1.1 KiB
YAML

name: Update Java API Docs
on:
push:
branches:
- main
paths:
- java
workflow_dispatch:
concurrency:
group: "apidocs-java"
cancel-in-progress: true
permissions:
contents: write
jobs:
publish:
name: Generate Java docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
build-root-directory: java
gradle-executable: java/gradlew
arguments: javadoc
- name: Get source commit
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Log source commit
run: echo $(git rev-parse --short HEAD) > java/build/docs/javadoc/version.txt
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: java/build/docs/javadoc
target-folder: docs/api/java
clean: true