Skip to content

Set up version-based documentation with mike - #128

Open
Asgabani wants to merge 1 commit into
TUDelftGeodesy:mainfrom
Asgabani:docs-versioned-mkdocs
Open

Asgabani wants to merge 1 commit into
TUDelftGeodesy:mainfrom
Asgabani:docs-versioned-mkdocs

Conversation

@Asgabani

@Asgabani Asgabani commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #122.

mkdocs.yml already declared extra.version.provider: mike (which enables the mkdocs-material version selector), but nothing actually deployed versioned docs: mike wasn't installed anywhere, and the release workflow ran a plain mkdocs gh-deploy --force, which overwrites the whole gh-pages branch with a single, unversioned build every release.

What this does:

  • Adds mike to the docs dependencies.
  • Replaces the gh-deploy step with mike deploy --push --update-aliases <major.minor> latest followed by mike set-default --push latest, deriving <major.minor> from the release tag (v0.1.20.1). One doc set per minor version, aliased to latest for the newest.
  • Configures the git identity mike needs to commit to gh-pages, and explicitly fetches the gh-pages branch first (a checkout of the triggering ref doesn't include other branches — mike's own docs flag this as a common CI gotcha).

Also fixes a pre-existing, unrelated break in the same workflow: pip install .[docs] needs a [project.optional-dependencies] table, but docs was only defined under [dependency-groups] (PEP 735, likely for local uv use). That mismatch meant the deploy job's install step silently installed no docs dependencies — not even mkdocs itself. Added the matching [project.optional-dependencies] table so .[docs] actually resolves; left the [dependency-groups] entry as-is for any uv-based local dev flow.

Testing: validated pyproject.toml (TOML parse) and doc_deploy.yml (YAML parse + ruff clean on the repo). This workflow only runs on release: published, so it can't be exercised in CI on the PR itself — happy to walk through the exact mike commands with a maintainer if useful.

mkdocs.yml already declared extra.version.provider: mike (enabling
the mkdocs-material version selector), but nothing actually deployed
versioned docs: mike wasn't installed anywhere, and the release
workflow ran a plain `mkdocs gh-deploy --force`, which overwrites the
whole gh-pages branch with a single, unversioned build every release.

- Add mike to the docs dependencies.
- Replace the gh-deploy step with `mike deploy --push --update-aliases
  <major.minor> latest` followed by `mike set-default --push latest`,
  deriving <major.minor> from the release tag (v0.1.2 -> 0.1). This
  keeps one doc set per minor version, aliased to "latest" for the
  newest.
- Configure the git identity mike needs to commit to gh-pages, and
  explicitly fetch the gh-pages branch first (a full checkout of the
  triggering ref doesn't include other branches, and mike's own docs
  call this out as a common CI gotcha).

Also fixes a pre-existing, unrelated break in the same workflow: `pip
install .[docs]` needs a [project.optional-dependencies] table, but
`docs` was only defined under [dependency-groups] (PEP 735, likely for
local `uv` use). That mismatch meant the deploy job's install step
silently installed no docs dependencies at all - not even mkdocs
itself - and gh-deploy could only have been working if these steps
were always failing further down without anyone noticing (no non-main
workflow exercises this path). Added the matching
[project.optional-dependencies] docs table so `.[docs]` actually
resolves; left the [dependency-groups] entry as-is for any uv-based
local dev flow.

Fixes TUDelftGeodesy#122
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create version based documentation

1 participant