Files
ripster/.github/workflows/docs.yml
T
michael c67ac593de
Deploy Docs to GitHub Pages / Build Documentation (push) Has been cancelled
Deploy Docs to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
0.12.0-17 Misc fixes
2026-03-30 19:15:23 +00:00

100 lines
2.5 KiB
YAML

name: Deploy Docs to GitHub Pages
on:
push:
branches:
- main
- dev
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.github/workflows/docs.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Für git-dates Plugin
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache pip packages
uses: actions/cache@v4
with:
key: mkdocs-material-${{ runner.os }}-${{ hashFiles('requirements-docs.txt') }}
path: ~/.cache/pip
restore-keys: |
mkdocs-material-${{ runner.os }}-
- name: Install MkDocs and dependencies
run: pip install -r requirements-docs.txt
- name: Build MkDocs site (main -> /, dev -> /dev)
env:
REF_NAME: ${{ github.ref_name }}
SHA: ${{ github.sha }}
run: |
set -euo pipefail
# Ensure both refs are available locally.
git fetch origin main dev
MAIN_REF="origin/main"
DEV_REF="origin/dev"
if [ "${REF_NAME}" = "main" ]; then
MAIN_REF="${SHA}"
fi
if [ "${REF_NAME}" = "dev" ]; then
DEV_REF="${SHA}"
fi
# Build each branch in its own worktree and merge into one Pages artifact:
# - main docs at site/
# - dev docs at site/dev/
rm -rf .worktrees site
mkdir -p .worktrees
git worktree add --detach .worktrees/main "${MAIN_REF}"
git worktree add --detach .worktrees/dev "${DEV_REF}"
mkdocs build --strict --verbose \
--config-file .worktrees/main/mkdocs.yml \
--site-dir site
mkdocs build --strict --verbose \
--config-file .worktrees/dev/mkdocs.yml \
--site-dir site/dev
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site/
deploy:
name: Deploy to GitHub Pages
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