Merge pull request #305 from jayzalani/master #8
This file contains hidden or 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: Build and Update Sphinx Docs | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Cache Sphinx build | |
uses: actions/cache@v3 | |
with: | |
path: docs/py_docs/_build | |
key: ${{ runner.os }}-sphinx-${{ hashFiles('docs/py_docs/**') }} | |
restore-keys: | | |
${{ runner.os }}-sphinx- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install "sphinx>=8.1.3" "sphinx-rtd-theme>=3.0.2" | |
pip install -e . | |
- name: Build Sphinx Docs | |
run: | | |
cd docs/py_docs | |
rm -rf _build/html/* # Clean old files | |
sphinx-build -b html . _build/html | |
- name: Commit updated docs | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add docs/py_docs/_build/html/* | |
git commit -m "Update Sphinx documentation in docs/py_docs/_build/html" || echo "No changes to commit" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |