Skip to content

Commit

Permalink
Use mike for multiple versions of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
synfinatic committed Jul 12, 2024
1 parent 33abd2b commit 3e07b81
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 20 deletions.
96 changes: 79 additions & 17 deletions .github/workflows/update-mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Docs
name: Build/Publish Docs on main
on:
push:
branches:
Expand All @@ -8,22 +8,84 @@ on:
- 'docs/**'
- 'mkdocs.yml'

permissions:
contents: write

jobs:
build:
name: Deploy docs
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4

- name: Deploy docs
uses: synfinatic/mkdocs-deploy-gh-pages@bump-mkdocs
# mhausenblas/mkdocs-deploy-gh-pages@master is an old version of mkdocs, so using my own
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CUSTOM_DOMAIN: optionaldomain.com
CONFIG_FILE: mkdocs.yml
# EXTRA_PACKAGES: build-base
# GITHUB_DOMAIN: github.myenterprise.com
REQUIREMENTS: docs/requirements.txt
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.11.6
- name: Install Dependencies
run: |
pip install mkdocs-material pillow cairosvg mike -r docs/requirements.txt
- name: Setup Docs Deploy
run: |
git config --global user.name "Docs Deploy"
git config --global user.email "docs.deploy@synfin.net"
- name: Build Docs Website
run: mike deploy --config-file mkdocs.yml --push develop


name: Build/Publish Latest Release Docs
on:
release:
types: [published]

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.11.6
- name: Install Dependencies
run: |
pip install mkdocs-material pillow cairosvg mike -r docs/requirements.txt
- name: Setup Docs Deploy
run: |
git config --global user.name "Docs Deploy"
git config --global user.email "docs.deploy@synfin.net"
- name: Build Docs Website
run: mike deploy --config-file mkdocs.yml --push --update-aliases ${{ github.event.release.tag_name }} latest


# name: Update Docs
# on:
# push:
# branches:
# - main
# paths:
# - '.github/**'
# - 'docs/**'
# - 'mkdocs.yml'
# jobs:
# build:
# name: Deploy docs
# runs-on: ubuntu-latest
# steps:
# - name: Checkout main
# uses: actions/checkout@v4
#
# - name: Deploy docs
# uses: synfinatic/mkdocs-deploy-gh-pages@bump-mkdocs
# # mhausenblas/mkdocs-deploy-gh-pages@master is an old version of mkdocs, so using my own
# # Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # CUSTOM_DOMAIN: optionaldomain.com
# CONFIG_FILE: mkdocs.yml
# # EXTRA_PACKAGES: build-base
# # GITHUB_DOMAIN: github.myenterprise.com
# REQUIREMENTS: docs/requirements.txt
2 changes: 1 addition & 1 deletion Dockerfile.mkdocs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM squidfunk/mkdocs-material:9.5.27
RUN pip install -r docs/requirements.txt
RUN pip install -r docs/requirements.txt mike
File renamed without changes.
File renamed without changes.
13 changes: 11 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,26 @@ extra:
provider: mike

extra_css:
- stylesheets/asciinema-player.css
- css/asciinema-player.css

extra_javascript:
- javascripts/asciinema-player.min.js
- js/asciinema-player.min.js

theme:
name: material

plugins:
- search
- mkdocs-asciinema # https://pypi.org/project/mkdocs-asciinema/
- mike:
# These fields are all optional; the defaults are as below...
alias_type: symlink
redirect_template: null
deploy_prefix: ''
canonical_version: null
version_selector: true
css_dir: css
javascript_dir: js

nav:
- 'Home': index.md
Expand Down

0 comments on commit 3e07b81

Please sign in to comment.