Skip to content

Publish docs to gh-pages branch #9

Publish docs to gh-pages branch

Publish docs to gh-pages branch #9

Workflow file for this run

name: Deploy Sphinx Docs to GitHub Pages
on:
push:
branches:
- main # Or 'master', or whatever your main branch is called
paths:
- 'docs/**' # Trigger only if changes are within the 'docs' directory
- '.github/workflows/docs.yml' # Also trigger if the workflow itself changes
workflow_dispatch: {} # Allows manual triggering from the GitHub Actions UI
permissions:
contents: write
jobs:
build-and-deploy:
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.x' # Use your desired Python version, e.g., '3.9', '3.10', '3.11'
architecture: 'x64' # Ensure 64-bit Python is set up
- name: Install Sphinx and dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Build Sphinx documentation
run: |
cd docs
make html
# Or, if you don't use make:
# sphinx-build -b html . _build/html
env:
SPHINXOPTS: "-W --keep-going" # Add -W to treat warnings as errors, --keep-going to continue on errors
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html