From c2260a5d07193662691849a3de29e78833f8c9dd Mon Sep 17 00:00:00 2001 From: Iahn Cajigas Date: Mon, 23 Mar 2026 22:52:26 -0400 Subject: [PATCH] Add GitHub Pages deployment workflow with sphinx_rtd_theme - New deploy-docs.yml: builds Sphinx HTML and deploys to GitHub Pages on every push to main (uses actions/deploy-pages v4) - docs/conf.py: switch to sphinx_rtd_theme with navigation options; exclude superpowers/ specs from build - pyproject.toml: add sphinx-rtd-theme>=3.0 to dev dependencies - Add .nojekyll marker in build step to preserve _static/ directories - Includes design spec at docs/superpowers/specs/ The live site at cajigaslab.github.io/nSTAT-python/ has been frozen since Feb 28 because no deployment workflow existed. This fix will automatically deploy fresh docs on every merge to main. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/deploy-docs.yml | 53 +++++++++++++++++++ docs/conf.py | 8 ++- ...26-03-24-github-pages-deployment-design.md | 38 +++++++++++++ pyproject.toml | 1 + 4 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 docs/superpowers/specs/2026-03-24-github-pages-deployment-design.md diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 00000000..3d28cb1a --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,53 @@ +name: deploy-docs + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: pip install -e .[dev] + + - name: Regenerate paper gallery artifacts + run: python tools/paper_examples/build_gallery.py + + - name: Build Sphinx docs + run: python -m sphinx -W -b html docs docs/_build/html + + - name: Add .nojekyll marker + run: touch docs/_build/html/.nojekyll + + - name: Configure Pages + uses: actions/configure-pages@v5 + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/_build/html + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/conf.py b/docs/conf.py index 86790cb6..d2dad863 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,5 +2,11 @@ author = "Cajigas Lab" release = "0.3.0" extensions = ["myst_parser"] -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "superpowers"] master_doc = "index" + +html_theme = "sphinx_rtd_theme" +html_theme_options = { + "navigation_depth": 3, + "collapse_navigation": False, +} diff --git a/docs/superpowers/specs/2026-03-24-github-pages-deployment-design.md b/docs/superpowers/specs/2026-03-24-github-pages-deployment-design.md new file mode 100644 index 00000000..30843e9a --- /dev/null +++ b/docs/superpowers/specs/2026-03-24-github-pages-deployment-design.md @@ -0,0 +1,38 @@ +# GitHub Pages Deployment Design + +**Date:** 2026-03-24 +**Status:** Approved + +## Problem + +The Python nSTAT GitHub Pages site (cajigaslab.github.io/nSTAT-python/) is frozen at a Feb 28, 2026 commit. The `docs-build` CI job verifies Sphinx compilation but never deploys the output. Over 20 merges to main have had no effect on the live site. + +## Solution + +A dedicated `deploy-docs.yml` workflow that builds Sphinx HTML with the Read the Docs theme and deploys it to GitHub Pages on every push to main. + +## Components + +### 1. `.github/workflows/deploy-docs.yml` + +New workflow triggered by push to main and workflow_dispatch. Uses GitHub's artifact-based Pages deployment (`actions/upload-pages-artifact` + `actions/deploy-pages`). Requires `pages: write` and `id-token: write` permissions. Concurrency group prevents overlapping deployments. + +### 2. `docs/conf.py` updates + +Switch from Alabaster (default) to `sphinx_rtd_theme`. Keep `myst_parser` extension. Set project metadata. + +### 3. `pyproject.toml` updates + +Add `sphinx-rtd-theme` to dev dependencies if not already present. + +### 4. `.nojekyll` marker + +Created during build to prevent Jekyll from ignoring `_static/` directories. + +## What Gets Deployed + +The existing docs/index.rst toctree: help home, paper overview, class definitions, examples, API reference, paper examples gallery with figure thumbnails. + +## What Doesn't Change + +The existing `docs-build` job in ci.yml remains as a PR build-verification step. diff --git a/pyproject.toml b/pyproject.toml index c119b14c..4dfa3094 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ dev = [ "pytest>=8.0", "scikit-image>=0.22", "sphinx>=8.0", + "sphinx-rtd-theme>=3.0", "myst-parser>=4.0", ]