From 0c517112c419627643fa4ba711f20cb0b783bdb5 Mon Sep 17 00:00:00 2001 From: "Nat Kershaw (MSFT)" Date: Mon, 3 Jan 2022 18:22:22 -0800 Subject: [PATCH] Automate Python API docs generation (#10116) --- .github/workflows/publish-python-apidocs.yml | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/publish-python-apidocs.yml diff --git a/.github/workflows/publish-python-apidocs.yml b/.github/workflows/publish-python-apidocs.yml new file mode 100644 index 0000000000..b2da6ed5f1 --- /dev/null +++ b/.github/workflows/publish-python-apidocs.yml @@ -0,0 +1,49 @@ +name: Update Python API Docs +on: + workflow_dispatch + +jobs: + publish: + name: Generate Python API docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install tools + run: | + sudo apt update + sudo apt-get install pip + sudo apt-get install graphviz + - name: Install dependencies + run: | + cd docs/python + pip install -r requirements.txt + pip install flatbuffers protobuf==3.19.1 + pip install -i https://test.pypi.org/simple/ ort-nightly + pip list + - name: Generate Python docs with Sphinx + run: | + cd tools/doc + ./builddoc.sh /usr/bin ../.. ../../build + - name: Set vars + id: vars + run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Check outputs + run: echo ${{ steps.vars.outputs.sha_short }} + - uses: actions/checkout@v2 + with: + ref: gh-pages + clean: false + - name: Move API docs into target area + run: | + rm -rf docs/api/python + mv build/docs/inference/html docs/api/python + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + branch: gh-pages-pr-python-docs + base: gh-pages + title: '[Automated]: Update Python API docs' + commit-message: 'Update Python API docs to commit ${{ steps.vars.outputs.sha_short }}' + add-paths: docs/api/python + + \ No newline at end of file