Skip to content

Commit

Permalink
Use mike for doc versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
mgao6767 committed Feb 2, 2025
1 parent b21e217 commit 2bb78cb
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 7 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: docs
name: Documentation
on:
push:
branches:
Expand Down Expand Up @@ -26,7 +26,13 @@ jobs:
run: |
uv sync --all-extras --dev
uv pip install .
- name: Deploy MkDocs
- name: Get Version from pyproject.toml
id: version
run: |
source .venv/bin/activate
mkdocs gh-deploy --force --remote-branch gh-pages
echo "VERSION=$(python -c 'import importlib.metadata; print(importlib.metadata.version("brms"))')" >> $GITHUB_ENV
- name: Deploy MkDocs with Mike
run: |
source .venv/bin/activate
mike deploy --push --branch gh-pages --update-aliases ${{ env.VERSION }} latest
mike set-default --push --branch gh-pages latest
8 changes: 5 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
site_name: Bank Risk Management Simulation
site_author: Mingze Gao
site_url: https://bankrisk.org
site_url: https://bankrisk.org/
site_description: >-
A bank risk management simulation framework
Expand All @@ -18,6 +18,7 @@ validation:

theme:
name: material
custom_dir: overrides
favicon: icon.png
logo: icon.png
palette:
Expand Down Expand Up @@ -54,8 +55,6 @@ theme:
- search.suggest
- search.highlight
- search.share
# - content.action.edit
# - content.action.view
- content.code.copy
- content.code.select
- content.code.annotate
Expand All @@ -70,6 +69,9 @@ theme:

extra:
generator: false
version:
provider: mike
alias: true
social:
- icon: fontawesome/brands/github
link: https://github.com/mgao6767/brms
Expand Down
8 changes: 8 additions & 0 deletions overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends "base.html" %}

{% block outdated %}
You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}">
<strong>Click here to go to latest.</strong>
</a>
{% endblock %}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Homepage = "https://bankrisk.org"
[dependency-groups]
dev = [
"isort>=5.13.2",
"mike>=2.1.3",
"mkdocs-git-revision-date-localized-plugin>=1.3.0",
"mkdocs-material>=9.6.1",
"pytest>=8.3.4",
Expand Down
62 changes: 61 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2bb78cb

Please sign in to comment.