Setup docs versioning

This commit is contained in:
2025-09-18 21:04:11 +02:00
parent 3081a1986b
commit 9a8647775d
3 changed files with 67 additions and 17 deletions

View File

@@ -14,9 +14,11 @@ on:
- 'docs/**'
- 'mkdocs.yml'
- 'docs-requirements.txt'
release:
types: [published]
permissions:
contents: read
contents: write
pages: write
id-token: write
@@ -27,11 +29,12 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
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
@@ -46,20 +49,58 @@ jobs:
run: |
mkdocs build --strict
- name: Upload documentation artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: ./site
deploy:
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
deploy-dev:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r docs-requirements.txt
- name: Configure Git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Deploy development version
run: |
mike deploy --push --update-aliases dev latest
deploy-release:
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r docs-requirements.txt
- name: Configure Git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Deploy release version
run: |
VERSION=${GITHUB_REF#refs/tags/}
mike deploy --push --update-aliases $VERSION stable
mike set-default --push stable

View File

@@ -2,3 +2,4 @@ mkdocs-material==9.5.3
mkdocs==1.5.3
pymdown-extensions==10.7
mkdocs-git-revision-date-localized-plugin==1.2.4
mike==2.0.0

View File

@@ -61,8 +61,16 @@ nav:
plugins:
- search
- git-revision-date-localized
- mike:
version_selector: true
css_dir: css
javascript_dir: js
canonical_version: null
extra:
version:
provider: mike
default: stable
social:
- icon: fontawesome/brands/github
link: https://github.com/lordmathis/llamactl