microsoft/onnxruntime-extensions
Publicmirrored from https://github.com/microsoft/onnxruntime-extensionsAvailable
.github/workflows/publish-python-apidocs.yml
58lines · modeblame
d39e8444Sayan Shaw2 years ago | 1 | name: Publish Python API Docs |
| 2 | | |
| 3 | # Run when the Python API changes or every month so that the artifact does not expire | |
| 4 | on: | |
| 5 | push: | |
| 6 | branches: | |
| 7 | - main | |
| 8 | paths: | |
| 9 | - onnxruntime_extensions/** | |
| 10 | - docs/python/** | |
| 11 | schedule: | |
| 12 | - cron: '0 0 1 * *' | |
| 13 | workflow_dispatch: | |
| 14 | | |
| 15 | concurrency: | |
| 16 | group: "apidocs-python" | |
| 17 | cancel-in-progress: true | |
| 18 | | |
| 19 | permissions: | |
| 20 | contents: write | |
| 21 | | |
| 22 | jobs: | |
| 23 | build: | |
| 24 | name: Generate Python API docs | |
| 25 | runs-on: ubuntu-latest | |
| 26 | steps: | |
| 27 | - uses: actions/checkout@v3 | |
| 28 | - name: Install tools | |
| 29 | run: | | |
| 30 | sudo apt-get update | |
| 31 | sudo apt-get install python3-pip | |
| 32 | - name: Install dependencies | |
| 33 | run: | | |
| 34 | python3 -m pip install --upgrade pip | |
| 35 | python3 -m pip install -r requirements-dev.txt | |
| 36 | python3 -m pip install -e . | |
| 37 | python3 -m pip list | |
| 38 | - name: Generate Python docs with Sphinx | |
| 39 | run: | | |
| 40 | set -e -x | |
| 41 | python3 -m pip install -r docs/python/requirements.txt | |
| 42 | rm -rf sphinx_output/docs/ | |
| 43 | python3 -m sphinx -j1 -v -T -b html -d sphinx_output/docs/extensions/_doctrees/html docs/python/ sphinx_output/docs/extensions/html | |
| 44 | - name: Log source commit | |
| 45 | run: | | |
| 46 | mkdir -p sphinx_output/docs/extensions/html/ | |
| 47 | git rev-parse --short HEAD >> sphinx_output/docs/extensions/html/source-version.txt | |
| 48 | - name: Move Python docs into site | |
| 49 | run: | | |
| 50 | rm -rf _site/docs/api/python | |
| 51 | mkdir -p _site/docs/api/ | |
| 52 | mv sphinx_output/docs/extensions/html _site/docs/api/python | |
| 53 | - name: Upload docs artifact | |
| 54 | uses: actions/upload-artifact@v3 | |
| 55 | with: | |
| 56 | name: onnxruntime-extensions-python-apidocs | |
| 57 | path: _site | |
| 58 | retention-days: 60 |