0.5.1 #3
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
| # Workflow to automatically build and deploy Sphinx documentation to GitHub Pages | |
| # This workflow is triggered on release publication or manual dispatch | |
| name: Deploy Documentation | |
| # Define trigger conditions | |
| on: | |
| # Trigger when a GitHub Release is published | |
| release: | |
| types: [published] | |
| # Allow manual trigger from the GitHub Actions tab | |
| workflow_dispatch: | |
| # Define permissions needed for this workflow | |
| permissions: | |
| contents: read # Read repository contents | |
| pages: write # Write to GitHub Pages | |
| id-token: write # Required for GitHub Pages deployment token | |
| # Ensure only one deployment runs at a time | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # Job 1: Build Sphinx documentation | |
| build: | |
| name: Build documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Clone the repository to access documentation source files | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Step 2: Install Python runtime (version 3.11) | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' # Cache pip dependencies for faster builds | |
| # Step 3: Install package with documentation dependencies | |
| # Note: Docs dependencies are in a Poetry group, not extras, | |
| # so we install them directly with pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install sphinx sphinx-rtd-theme nbsphinx sphinx-autodoc-typehints ipykernel pandoc | |
| pip install -e . | |
| # Step 4: Build HTML documentation using Sphinx | |
| # Uses sphinx-build directly (Makefile has been removed for simplicity) | |
| - name: Build documentation | |
| run: | | |
| cd docs | |
| sphinx-build -b html source build/html | |
| # Step 5: Upload built HTML as an artifact for the deploy job | |
| # The artifact contains the complete static website | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'docs/build/html' | |
| # Job 2: Deploy documentation to GitHub Pages | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| # Only deploy on pushes to main branch (not on PRs or other branches) | |
| if: github.ref == 'refs/heads/main' | |
| # Use the 'github-pages' environment | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| # Wait for build job to complete before deploying | |
| needs: build | |
| steps: | |
| # Step 1: Deploy the uploaded artifact to GitHub Pages | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |