MakerFLOSS/.forgejo/workflows/docs.yml

47 lines
1.2 KiB
YAML
Raw Permalink Normal View History

name: Build docs site
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
container:
image: python:3.13-bookworm
volumes:
- /srv/docs-makerfloss/html:/output
steps:
- name: Install git for actions/checkout
run: |
apt-get update -qq
apt-get install -y --no-install-recommends git rsync
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python dependencies
run: pip install --quiet -r requirements.txt
- name: Regenerate hardware index
run: python3 scripts/gen_overview.py --category hardware
- name: Fail on drift in docs/hardware/index.md
run: |
if ! git diff --exit-code docs/hardware/index.md; then
echo
echo "::error::docs/hardware/index.md is stale."
echo "Regenerate locally via 'make docs-index' and commit the result."
exit 1
fi
- name: Build site (strict)
run: mkdocs build --strict
- name: Publish to /output (main only)
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: rsync -a --delete site/ /output/