-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use sphinx-multiversion to support documentation for multiple versions (
#349) * Use sphinx-multiversion to support documentation for multiple versions * Change message when seeing development version * Use only-arg branch of sphinx-multiversion to avoid re-writing old documentation * Add docs.yml to automatically generate and publish docs
- Loading branch information
1 parent
a273d20
commit 963b1bb
Showing
7 changed files
with
172 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
name: Publish documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
# Example of using a custom build-command. | ||
- uses: ammaraskar/sphinx-action@master | ||
with: | ||
pre-build-command: python -m pip install -r requirements.txt -r requirements-dev.txt | ||
build-command: "sphinx-multiversion . ./_build/html" | ||
docs-folder: "docs/" | ||
|
||
# Great extra actions to compose with: | ||
# Create an artifact of the html output. | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: DocumentationHTML | ||
path: docs/_build/html/ | ||
|
||
# Publish built docs to gh-pages branch. | ||
# =============================== | ||
- name: Commit documentation changes | ||
run: | | ||
git clone https://github.com/bambinos/bambi.git --branch gh-pages --single-branch gh-pages | ||
cp docs/_assets/gh-pages-redirect.html docs/_build/index.html | ||
cp -r docs/_build/html/* gh-pages/ | ||
cd gh-pages | ||
touch .nojekyll | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add . | ||
git commit -m "Update documentation" -a || true | ||
# The above command will fail if no changes were present, so we ignore | ||
# that. | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
branch: gh-pages | ||
directory: gh-pages | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# =============================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Redirecting to https://bambinos.github.io/bambi/master/</title> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="refresh" content="0; url=./master/index.html"> | ||
<link rel="canonical" href="https://bambinos.github.io/bambi/"> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{% if versions %} | ||
|
||
{% if current_version != versions.tags[-1] and current_version != versions.branches[0] %} | ||
<p style="margin-top: 1em; margin-bottom: 0;"> | ||
<strong> | ||
You're reading an old version of this documentation (v. {{current_version.name}}).<br> | ||
If you want up-to-date information, please have a look at <a href="{{ vpathto(versions.tags[-1].name) }}">latest</a>. | ||
</strong> | ||
</p> | ||
{% endif %} | ||
|
||
{% if current_version == versions.branches[0] %} | ||
<p style="margin-top: 1em; margin-bottom: 0;"> | ||
<strong> | ||
You're reading the documentation for a development version ({{current_version.name}}).<br> | ||
For the latest released version, please have a look at <a href="{{ vpathto(versions.tags[-1].name) }}">latest</a>. | ||
</strong> | ||
</p> | ||
{% endif %} | ||
|
||
<nav class="bd-links" id="bd-docs-nav" aria-label="Versions navigation"> | ||
<div class="bd-toc-item active"> | ||
<ul class="current nav bd-sidenav"> | ||
<li class="toctree-l1 has-children"> | ||
<p class="caption"><span class="caption-text">Version</span></p> | ||
<input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"> | ||
<label for="toctree-checkbox-1"> <i class="fas fa-chevron-down"></i></label> | ||
|
||
<ul> | ||
|
||
{%- for item in versions.branches %} | ||
{% if item == current_version %} | ||
<li class="toctree-l2 current active"><a href="{{ item.url }}"> Development </a></li> | ||
{% else %} | ||
<li><a href="{{ item.url }}"> Development </a></li> | ||
{% endif %} | ||
{%- endfor %} | ||
|
||
{%- for item in versions.tags[::-1] %} | ||
|
||
{% if item == current_version %} | ||
|
||
{% if loop.first %} | ||
<li class="toctree-l2 current active"><a href="{{ item.url }}">{{ item.name }} (latest)</a></li> | ||
{% else %} | ||
<li class="toctree-l2 current active"><a href="{{ item.url }}">{{ item.name }}</a></li> | ||
{% endif %} | ||
|
||
{% else %} | ||
|
||
{% if loop.first %} | ||
<li><a href="{{ item.url }}">{{ item.name }} (latest)</a></li> | ||
{% else %} | ||
<li><a href="{{ item.url }}">{{ item.name }}</a></li> | ||
{% endif %} | ||
|
||
{% endif %} | ||
{%- endfor %} | ||
|
||
</ul> | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> | ||
|
||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters