Skip to content

Commit 79662f7

Browse files
Merge pull request #195 from thorinaboenke/feature/github_pages
Feature/GitHub pages
2 parents 07ae939 + 102a489 commit 79662f7

6 files changed

Lines changed: 86 additions & 61 deletions

File tree

.github/workflows/publish-docs.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- development
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0 # Crucial: sphinx-multiversion needs git history to find tags/branches
20+
21+
- name: Set up uv
22+
uses: astral-sh/setup-uv@v5
23+
with:
24+
python-version: "3.12"
25+
enable-cache: true
26+
27+
- name: Build Multi-version Docs
28+
run: |
29+
uv run --with-requirements docs/requirements.txt sphinx-multiversion docs/source docs/build/html
30+
31+
32+
- name: Create Redirect Root
33+
run: |
34+
# Redirects root URL (repo.io/) to the main branch docs (repo.io/main/)
35+
echo '<meta http-equiv="refresh" content="0; url=main/index.html">' > docs/build/html/index.html
36+
37+
- name: Deploy to GitHub Pages
38+
uses: peaceiris/actions-gh-pages@v4
39+
with:
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
publish_branch: gh-pages
42+
publish_dir: docs/build/html

Jenkinsfile

Lines changed: 0 additions & 60 deletions
This file was deleted.

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ sphinx
22
sphinx_rtd_theme
33
sphinx_toolbox
44
myst_parser
5+
sphinx-multiversion

docs/source/_templates/layout.html

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{% if versions %}
2+
<div class="rst-versions" role="note" aria-label="versions">
3+
<span class="rst-current-version">
4+
<span class="fa fa-book"> Version</span>
5+
{{ current_version.name }}
6+
</span>
7+
8+
<div class="rst-other-versions">
9+
<dl>
10+
<dt>Versions</dt>
11+
{% for v in versions %}
12+
<dd>
13+
<a href="{{ v.url }}">{{ v.name }}</a>
14+
</dd>
15+
{% endfor %}
16+
</dl>
17+
</div>
18+
</div>
19+
{% endif %}

docs/source/conf.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@
1818
# -- General configuration ---------------------------------------------------
1919
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2020

21-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'myst_parser', 'sphinx_toolbox.confval']
21+
extensions = [
22+
'sphinx_multiversion',
23+
'sphinx.ext.autodoc',
24+
'sphinx.ext.napoleon',
25+
'myst_parser',
26+
'sphinx_toolbox.confval']
27+
28+
# Configure what branches/tags to include
29+
smv_tag_whitelist = r'^v?\d+\.\d+\.\d+$' # Includes tags like v1.0.0
30+
smv_branch_whitelist = r'^(main|development)$' # Includes the main branch
31+
smv_remote_whitelist = None # Only look at origin
2232

2333
templates_path = ['_templates']
2434
exclude_patterns = [] # type: ignore
@@ -34,3 +44,16 @@
3444
'navigation_depth': 2,
3545
'collapse_navigation': True,
3646
}
47+
48+
html_sidebars = {
49+
'**': [
50+
'navigation.html',
51+
'relations.html',
52+
'searchbox.html',
53+
'versions.html',
54+
],
55+
}
56+
57+
html_context = {
58+
'display_lower_left': True,
59+
}

0 commit comments

Comments
 (0)