Skip to content

Commit b73212c

Browse files
authored
Revert "Revert "Set up multi-version docs""
1 parent a4c4f88 commit b73212c

3 files changed

Lines changed: 19 additions & 6 deletions

File tree

.github/workflows/docs_build_and_deploy.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- main
1212
tags:
1313
- 'v*'
14+
pull_request:
1415
workflow_dispatch:
1516

1617
# Cancel in-progress runs if a new run is triggered, except for main branch.
@@ -23,7 +24,7 @@ jobs:
2324
name: Build Sphinx Docs
2425
runs-on: ubuntu-latest
2526
steps:
26-
- uses: neuroinformatics-unit/actions/build_sphinx_docs@main
27+
- uses: neuroinformatics-unit/actions/build_sphinx_docs@v2
2728
with:
2829
use-artifactci: lazy
2930

@@ -32,9 +33,14 @@ jobs:
3233
needs: build_sphinx_docs
3334
permissions:
3435
contents: write
35-
if: github.event_name == 'push'
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')
3641
runs-on: ubuntu-latest
3742
steps:
38-
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs@v2
43+
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs_multiversion@v2
3944
with:
4045
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)