Skip to content

Commit 136a2e1

Browse files
Set up multi-version docs (#633)
* adapt conf.py and docs CI worflow for multi-version docs * Update install and get_started links in README * use the stabler v2 version of docs actions --------- Co-authored-by: JoeZiminski <joseph.j.ziminski@gmail.com>
1 parent 8d44fb3 commit 136a2e1

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/docs_build_and_deploy.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
name: Build Sphinx Docs
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: neuroinformatics-unit/actions/build_sphinx_docs@main
27+
- uses: neuroinformatics-unit/actions/build_sphinx_docs@v2
2828
with:
2929
use-artifactci: lazy
3030

@@ -33,9 +33,14 @@ jobs:
3333
needs: build_sphinx_docs
3434
permissions:
3535
contents: write
36-
if: github.event_name == 'push' && github.ref_type == 'tag'
36+
# runs on releases, push to main, or manual dispatch on main
37+
if: |
38+
(github.event_name == 'push' && github.ref_type == 'tag') ||
39+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
40+
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
3741
runs-on: ubuntu-latest
3842
steps:
39-
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs@v2
43+
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs_multiversion@v2
4044
with:
4145
secret_input: ${{ secrets.GITHUB_TOKEN }}
46+
switcher-url: https://datashuttle.neuroinformatics.dev/latest/_static/switcher.json

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
**datashuttle** is a tool to automate creation, validation and transfer of neuroscience project folders.
44

5-
Learn how to [Install](https://datashuttle.neuroinformatics.dev/pages/get_started/install.html)
5+
Learn how to [Install](https://datashuttle.neuroinformatics.dev/latest/pages/get_started/install.html)
66
and
7-
[Get Started](https://datashuttle.neuroinformatics.dev/pages/get_started/index.html)
7+
[Get Started](https://datashuttle.neuroinformatics.dev/latest/pages/get_started/index.html)
88
on the
99
[**datashuttle** website](https://datashuttle.neuroinformatics.dev).
1010

docs/source/conf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
# Retrieve the version number from the package
2424
try:
2525
release = setuptools_scm.get_version(root="../..", relative_to=__file__)
26-
release = release.split(".dev")[0] # remove dev tag and git hash
26+
release = release.split("+")[0] # remove git hash
2727
except LookupError:
2828
# if git is not initialised, still allow local build
2929
# with a dummy version
3030
release = "0.0.0"
3131

32+
doc_version = "dev" if "dev" in release else f"v{release}"
33+
3234
# -- General configuration ---------------------------------------------------
3335
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
3436

@@ -148,6 +150,11 @@
148150
"type": "fontawesome",
149151
},
150152
],
153+
"switcher": {
154+
"json_url": "https://datashuttle.neuroinformatics.dev/latest/_static/switcher.json",
155+
"version_match": doc_version,
156+
},
157+
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
151158
"logo": {
152159
"text": f"datashuttle v{release}",
153160
"image_light": "_static/logo_light.png",

0 commit comments

Comments
 (0)