Update api spec (#308) #196
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: generate docs | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: main | |
paths: | |
- docs/conf.py | |
- '**.rst' | |
- '**.py' | |
- .github/workflows/generate-docs.yml | |
jobs: | |
generate-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
# Installation instructions are from: https://python-poetry.org/docs/ | |
- name: Install dependencies | |
shell: bash | |
run: | | |
sudo apt update && sudo apt install -y \ | |
enchant-2 \ | |
--no-install-recommends | |
pip install \ | |
poetry | |
- name: Build | |
shell: bash | |
run: | | |
poetry build | |
- name: Generate the docs | |
shell: bash | |
run: | | |
rm -rf docs/html | |
rm -rf docs/_autosummary | |
poetry install | |
poetry run sphinx-build -b html docs/ docs/html/ | |
- name: Check for modified files | |
id: git-check | |
run: echo ::set-output name=modified::$(if git diff-index --ignore-submodules --quiet HEAD --; then echo "false"; else echo "true"; fi) | |
- name: Commit changes, if any | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git add . | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git commit -am "I HAVE GENERATED YOUR NEW DOCS!" || true | |
git fetch origin | |
git rebase origin/${{github.ref_name }} || true | |
git push origin ${{github.ref_name }} | |