Skip to content

Commit 4445649

Browse files
committed
Add versioned documentation
Setup mike to provide versioned builds of the documentation. The goal is to have versioned docs for stable releases (0.23.0, 0.24.0) and development docs that can progress along with the code. This allows us to tailor docs to the next upcoming version as we no longer need to care about diversion between rendered docs and the latest release. Versions: * development (alias: unstable) on each push to the main branch * MAJOR.MINOR.PATCH (alias: stable, latest for the newest version) * for each "final" release tag * for each push to doc maintenance branches: doc/MAJOR.MINOR.PATCH The default version should the current stable version. The doc maintenance branches may be used to update the version specific documentation when issues arise after a release.
1 parent 7512e23 commit 4445649

File tree

4 files changed

+53
-52
lines changed

4 files changed

+53
-52
lines changed

.github/workflows/docs-deploy.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy docs
2+
3+
on:
4+
push:
5+
branches:
6+
# Main branch for development docs
7+
- main
8+
9+
# Doc maintenance branches
10+
- doc/[0-9]+.[0-9]+.[0-9]+
11+
tags:
12+
# Stable release tags
13+
- v[0-9]+.[0-9]+.[0-9]+
14+
workflow_dispatch:
15+
16+
jobs:
17+
deploy:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- name: Install python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: 3.x
28+
- name: Setup cache
29+
uses: actions/cache@v4
30+
with:
31+
key: ${{ github.ref }}
32+
path: .cache
33+
- name: Setup dependencies
34+
run: pip install -r docs/requirements.txt
35+
- name: Configure git
36+
run: |
37+
git config user.name github-actions
38+
git config user.email [email protected]
39+
- name: Deploy development docs
40+
if: github.ref == 'refs/heads/main'
41+
run: mike deploy --push development unstable
42+
- name: Deploy stable docs from doc branches
43+
if: startsWith(github.ref, 'refs/heads/doc/')
44+
run: mike deploy --push ${GITHUB_REF_NAME##*/}
45+
- name: Deploy stable docs from tag
46+
if: startsWith(github.ref, 'refs/tags/v')
47+
# This assumes that only newer tags are pushed
48+
run: mike deploy --push --update-aliases ${GITHUB_REF_NAME#v} stable latest

.github/workflows/docs.yml

-52
This file was deleted.

docs/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
mike~=2.1
12
mkdocs-include-markdown-plugin~=7.1
23
mkdocs-macros-plugin~=1.3
34
mkdocs-material[imaging]~=9.5

mkdocs.yml

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ plugins:
7171
- include-markdown:
7272
- minify:
7373
minify_html: true
74+
- mike:
7475
- social: {}
7576
- redirects:
7677
redirect_maps:
@@ -90,6 +91,9 @@ plugins:
9091

9192
# Customization
9293
extra:
94+
version:
95+
alias: true
96+
provider: mike
9397
annotate:
9498
json: [.s2]
9599
social:

0 commit comments

Comments
 (0)