MakerFLOSS/.forgejo/workflows/docs.yml
sjat b7fb69cf9a ci(rack): generate rack artifacts, run tests, add nav entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 14:00:48 +02:00

67 lines
2.1 KiB
YAML

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, rsync, nodejs for actions/checkout
run: |
apt-get update -qq
apt-get install -y --no-install-recommends git rsync nodejs
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python dependencies
run: pip install --quiet -r requirements.txt
- name: Install dev dependencies and run tests
run: |
pip install --quiet -r requirements-dev.txt
pytest -q
- name: Regenerate hardware and services indices
run: |
python3 scripts/gen_overview.py --category hardware
python3 scripts/gen_overview.py --category services
python3 scripts/gen_rack.py
- name: Fail on drift in generated indices
run: |
if ! git diff --exit-code docs/hardware/index.md docs/services/index.md docs/infrastructure/racks/; then
echo
echo "::error::A generated index 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/
- name: Notify ntfy on failure
if: failure() && github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
curl -sf \
-H "Title: docs.makerfloss.eu build failed" \
-H "Priority: high" \
-H "Tags: warning,rotating_light" \
-d "Run #${{ github.run_number }} on ${{ github.ref_name }}@${{ github.sha }}
${{ github.event.head_commit.message }}
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
"https://ntfy.sh/${{ secrets.NTFY_TOPIC }}" || true