|
| 1 | +--- |
| 2 | +name: Versioned docs site with a version switcher |
| 3 | +tags: |
| 4 | + - shapepipe |
| 5 | + - docs |
| 6 | + - ci |
| 7 | +created-at: 2026-05-31T20:39:06.459699229+02:00 |
| 8 | +outcome: 'PR #738 (off develop): docs site now versioned — stable@root (non-destructive to existing URLs), develop@/latest/, tags@/vX.Y.Z/, switcher.json drives the dropdown. Fixes that the site published only from master (~78 commits behind) so container.md/canfar.md were never published. CI green incl. real dev-image build + PR-preview artifact.' |
| 9 | +--- |
| 10 | + |
| 11 | +## Why |
| 12 | + |
| 13 | +`cd.yml` published the Sphinx site only on push to `master`, which sits ~78 |
| 14 | +commits behind `develop`. So the public docs described a stale release while |
| 15 | +everyone runs `develop`, and six pages written on `develop` — `container.md`, |
| 16 | +`canfar.md`, four others — had **never been published** (`container.html` → |
| 17 | +404). Surfaced when checking where the README's container link would land. |
| 18 | + |
| 19 | +## Design |
| 20 | + |
| 21 | +Versioned, not just "publish from develop." gh-pages layout is **additive**: |
| 22 | +`master`→ site **root** (stable; keeps every existing `/installation.html`-style |
| 23 | +URL working), `develop`→ `/latest/`, tags `v*`→ `/<tag>/`. A root `switcher.json` |
| 24 | +(tracked in `docs/`) drives the pydata/`sphinx-book-theme` dropdown; |
| 25 | +`DOCS_VERSION` (set by the workflow per ref) tells `conf.py` which entry to |
| 26 | +highlight. Each deploy uses `keep_files: true`, so it only writes its own slice |
| 27 | +and never clobbers siblings — every step is non-destructive, including the first |
| 28 | +`develop` run (adds `/latest/` + `switcher.json`, leaves root untouched). |
| 29 | + |
| 30 | +**Per-ref builds, not `sphinx-multiversion`.** autodoc imports `shapepipe`, so an |
| 31 | +old tag must build against *its own* deps. Multiversion uses one shared env |
| 32 | +across all refs → breaks autodoc on old tags. Building each ref in its own dev |
| 33 | +image at its own time sidesteps that entirely. PRs touching docs build + upload |
| 34 | +the HTML as an artifact but don't deploy → broken builds caught pre-merge, |
| 35 | +reviewers get a preview. `conf.py` version now comes from package metadata |
| 36 | +(killed the hand-maintained `1.0.1`, actual is `1.1.0`). |
| 37 | + |
| 38 | +## The recurring bit-rot pattern |
| 39 | + |
| 40 | +Same shape as [[shapepipe/mpi-hybrid]]: a path the repo's CI never exercises |
| 41 | +silently rots, and *enabling* it surfaces the breakage. Here, the docs build |
| 42 | +only ever ran on `master` (old flat layout), so `sphinx-apidoc … shapepipe` |
| 43 | +went stale when the package moved to src-layout (`src/shapepipe`); the first |
| 44 | +`develop` build failed `/app/shapepipe is not a directory`. Fixed to |
| 45 | +`src/shapepipe`. The lesson keeps repeating — unexercised paths (MPI, docs |
| 46 | +deploy) drift undetected; the fix is to *run them in CI*, which this PR now does |
| 47 | +for docs on every push and every docs-touching PR. |
| 48 | + |
| 49 | +## Follow-ups (not in PR) |
| 50 | + |
| 51 | +Seed `switcher.json` with the first real release entry when the next version is |
| 52 | +tagged; one-time `master` release to refresh root with current docs. Policy |
| 53 | +nod: the site now publishes `develop` as `latest`, so in-development docs are |
| 54 | +publicly visible — right for an active pipeline, but a conscious shift. |
0 commit comments