Skip to content

Commit 87a473f

Browse files
authored
Merge pull request #70 from amrit110/feat/mike-versioned-docs
feat: add mike-based versioned docs with version selector
2 parents 8711175 + e1567e4 commit 87a473f

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

.github/workflows/docs.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ on:
55
paths:
66
- "docs/**"
77
- "mkdocs.yml"
8+
- "pyproject.toml"
9+
tags:
10+
- "v*.*.*"
811
pull_request:
912
paths:
1013
- "docs/**"
1114
- "mkdocs.yml"
15+
- "pyproject.toml"
1216

1317
permissions:
1418
contents: write
@@ -21,18 +25,43 @@ jobs:
2125
- uses: actions/setup-python@v5
2226
with:
2327
python-version: "3.12"
24-
- run: pip install mkdocs-material pymdown-extensions
28+
- run: pip install mkdocs-material pymdown-extensions mike
2529
- name: Build docs (strict)
2630
run: mkdocs build --strict
2731

28-
deploy:
32+
deploy-dev:
2933
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
3034
needs: validate
3135
runs-on: ubuntu-latest
3236
steps:
3337
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
- uses: actions/setup-python@v5
41+
with:
42+
python-version: "3.12"
43+
- run: pip install mkdocs-material pymdown-extensions mike
44+
- run: git config user.name "github-actions[bot]"
45+
- run: git config user.email "github-actions[bot]@users.noreply.github.com"
46+
- name: Deploy dev docs
47+
run: mike deploy --push --update-aliases dev
48+
49+
deploy-release:
50+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
51+
needs: validate
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
3457
- uses: actions/setup-python@v5
3558
with:
3659
python-version: "3.12"
37-
- run: pip install mkdocs-material pymdown-extensions
38-
- run: mkdocs gh-deploy --force
60+
- run: pip install mkdocs-material pymdown-extensions mike
61+
- run: git config user.name "github-actions[bot]"
62+
- run: git config user.email "github-actions[bot]@users.noreply.github.com"
63+
- name: Deploy versioned docs
64+
run: |
65+
VERSION="${GITHUB_REF_NAME#v}"
66+
mike deploy --push --update-aliases "$VERSION" latest
67+
mike set-default --push latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
data/
2+
.venv/
3+
/site/
24
__pycache__/
35
*.py[cod]
46
.ruff_cache/

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The format is based on Keep a Changelog, and the project follows Semantic Versio
1313
- Standardised NumPy docstrings across all public functions and classes in `export.py`, `inspect.py`, `writers.py`, and the `tools/` and `providers/` layers. No behaviour changes.
1414
### Added
1515

16+
- Versioned documentation with a version selector powered by `mike` and MkDocs Material. Each release tag deploys a pinned version; pushes to `main` update a `dev` alias. The `mike`, `mkdocs-material`, and `pymdown-extensions` packages are now included in the `[dev]` optional group.
17+
1618
- `load_export(path)` reader API that loads any export produced by `export_batch(...)` — both combined (single file) and per-item (directory) layouts — and returns a structured `ExportResult`. Failed points are NaN-filled rather than dropped, partial model runs are surfaced via `status="partial"`, and `ExportResult.embedding(model)` provides a typed shortcut to the embedding array.
1719

1820
### Fixed

mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ markdown_extensions:
4545
- toc:
4646
permalink: true
4747

48+
extra:
49+
version:
50+
provider: mike
51+
default: latest
52+
alias: true
53+
4854
extra_javascript:
4955
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
5056

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ dev = [
7878
"pytest-xdist>=3.0",
7979
"ruff>=0.5.0",
8080
"pre-commit>=3.0",
81+
"mkdocs-material>=9.5",
82+
"pymdown-extensions>=10.0",
83+
"mike>=2.1",
8184
]
8285

8386
[project.scripts]

0 commit comments

Comments
 (0)