Skip to content

Commit 97171ca

Browse files
committed
chore: update dispatcher script
1 parent 371a508 commit 97171ca

3 files changed

Lines changed: 46 additions & 10 deletions

File tree

‎.github/workflows/dispatch-after-pages-build.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ name: Dispatch switcher after Pages build
55
on:
66
page_build:
77

8-
permissions:
9-
repository_dispatch: write
10-
118
jobs:
129
dispatch:
1310
runs-on: ubuntu-latest

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ We use [Nox](https://nox.thea.codes/) to standardize testing, linting, and docum
187187
nox -s format
188188
```
189189

190-
- **Type Checking**: Run static type analysis with mypy
190+
- **Type Checking**: Run static type analysis with pyrefly
191191
```bash
192192
nox -s typing
193193
```
@@ -253,12 +253,7 @@ We provide several nox sessions for different documentation needs:
253253
nox -s docs_serve
254254
```
255255

256-
- **Generate switcher**: Generate version switcher JSON for Read-the-Docs
257-
```bash
258-
nox -s generate_switcher
259-
```
260-
261-
- **Full local check**: Build docs and generate switcher
256+
- **Full local check**: Build HTML documentation
262257
```bash
263258
nox -s docs_full
264259
```

‎RELEASE.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,47 @@ The release workflow (`.github/workflows/build-and-publish.yml`) is triggered by
149149
- **`main`**: Stable releases and release tags
150150
- **`dev`**: Active development branch
151151
- Pull requests: `dev` → `main` for releases
152+
153+
### Documentation Version Switcher
154+
155+
The documentation uses a centralized version switcher that allows users to navigate between different documentation versions (stable, latest, and specific releases). This system is designed to work across all deployed documentation versions automatically.
156+
157+
#### Architecture
158+
159+
The version switcher uses an **external, centrally-managed approach**:
160+
161+
1. **External Storage**: The `switcher.json` file is maintained in a separate repository: [`saezlab/corneto-data`](https://github.com/saezlab/corneto-data)
162+
- Located at: `assets/docs/switcher.json`
163+
- Contains entries for all available documentation versions
164+
- Each entry specifies: version name, version identifier, and documentation URL
165+
166+
2. **Dynamic Fetching**: Each documentation build fetches the switcher dynamically from:
167+
```
168+
https://raw.githubusercontent.com/saezlab/corneto-data/refs/heads/main/assets/docs/switcher.json
169+
```
170+
- A timestamp parameter is added to bypass browser caching
171+
- Configured in `docs/conf.py` via the `_switcher_url_with_ts()` function
172+
173+
3. **Automated Updates**: When documentation is deployed to GitHub Pages:
174+
- The `page_build` event triggers (`.github/workflows/dispatch-after-pages-build.yml`)
175+
- A `repository_dispatch` event is sent to the `corneto-data` repository
176+
- The `corneto-data` repository automatically updates `switcher.json` with the new version
177+
- Requires the `SWITCHER_PAT` secret (Personal Access Token) for cross-repository access
178+
179+
4. **Version Mapping**: Documentation deployments use the following version identifiers:
180+
- `dev` branch → deployed as `"latest"`
181+
- `main` branch → deployed as `"stable"` (typically marked as preferred)
182+
- Git tags (e.g., `v1.0.0`) → deployed using the tag name
183+
184+
The `SPHINX_VERSION_MATCH` environment variable (set in `.github/workflows/deploy-docs.yml`) tells the PyData Sphinx Theme which version is currently being viewed.
185+
186+
#### Benefits of This Approach
187+
188+
- **Central Management**: One `switcher.json` serves all deployed documentation versions
189+
- **Automatic Updates**: Old deployed docs automatically show new versions in the switcher dropdown
190+
- **No Regeneration Needed**: Previously deployed documentation doesn't need to be rebuilt to show new versions
191+
- **Consistency**: All documentation versions display the same version list
192+
193+
#### Manual Switcher Updates
194+
195+
If the automatic workflow fails or manual intervention is needed, the `switcher.json` file can be updated directly in the [`saezlab/corneto-data`](https://github.com/saezlab/corneto-data) repository at `assets/docs/switcher.json`.

0 commit comments

Comments
 (0)