mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
doc: add versioning using "mike"
The Python tool 'mike'[1] helps manage multiple versions of MkDocs-powered documentation. Only required when building the kernelkit.org site docs! For each new tag, that steps year or month, a new version of is created of the documentation, in a separate sub-directory on the gh-pages branch. Strategy - Version Grouping with Early Publishing: - Extract YEAR.MONTH from tag E.g., v25.06.0-beta1, v25.06.0-rc1, v25.06.0, v25.06.1 → become version 25.06 - From first pre-release onwards: - v25.06.0-beta1 → creates docs version 25.06 - v25.06.0-rc1 → updates docs version 25.06 - v25.06.0 (GA) → updates docs version 25.06 - v25.06.1 (patch) → updates docs version 25.06 - New major/minor series: - v25.07.0-beta1 → creates new docs version 25.07 Benefits: - Users get docs as soon as beta/rc is available - Patches update existing docs (logical since patches rarely change docs significantly) - Clean version grouping by YEAR.MONTH - Mike handles create vs update automatically [1]: https://github.com/jimporter/mike Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+29
-23
@@ -4,6 +4,9 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- doc
|
||||
- main
|
||||
tags:
|
||||
- 'v*'
|
||||
paths:
|
||||
- 'doc/**'
|
||||
- 'mkdocs.yml'
|
||||
@@ -16,22 +19,20 @@ on:
|
||||
- '.github/workflows/docs.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: "pages"
|
||||
group: "docs-${{ github.ref }}"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Needed for git-revision-date-localized plugin
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
@@ -44,23 +45,28 @@ jobs:
|
||||
pipx inject mkdocs mkdocs-material
|
||||
pipx inject mkdocs pymdown-extensions
|
||||
pipx inject mkdocs mkdocs-callouts
|
||||
pipx inject mkdocs mike
|
||||
# Workaround, if pipx inject fails to install symlink
|
||||
ln -s "$(pipx environment -V PIPX_LOCAL_VENVS)/mkdocs/bin/mike" \
|
||||
"$(pipx environment -V PIPX_BIN_DIR)/mike" || true
|
||||
|
||||
- name: Build documentation
|
||||
run: mkdocs build
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: site/
|
||||
- name: Deploy dev version
|
||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/doc' || github.ref == 'refs/heads/main')
|
||||
run: |
|
||||
mike deploy --push --update-aliases dev latest
|
||||
mike set-default --push latest
|
||||
|
||||
deploy:
|
||||
if: github.ref == 'refs/heads/doc' && github.event_name == 'push'
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
- name: Deploy tagged version
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
TAG=${GITHUB_REF#refs/tags/v}
|
||||
# Extract YEAR.MONTH from tag (e.g., v25.06.0-beta1 -> 25.06)
|
||||
VERSION=$(echo $TAG | sed -E 's/^([0-9]+\.[0-9]+)(\.[0-9]+)?(-.*)?$/\1/')
|
||||
echo "Deploying tag $TAG as docs version $VERSION"
|
||||
mike deploy --push --update-aliases $VERSION latest
|
||||
mike set-default --push latest
|
||||
|
||||
@@ -110,7 +110,10 @@ markdown_extensions:
|
||||
plugins:
|
||||
- search
|
||||
- callouts
|
||||
- mike
|
||||
|
||||
extra:
|
||||
generator: false
|
||||
homepage: https://kernelkit.org/
|
||||
version:
|
||||
provider: mike
|
||||
|
||||
Reference in New Issue
Block a user