ludic/.forgejo/workflows/docs.yml
Orkuncakilkaya 1858ab65ad
All checks were successful
docs / build-and-deploy (push) Successful in 12s
ci(docs): run on the docker runner label, not ubuntu-latest
The docs workflow sat in "Waiting" indefinitely — "no online runner found
matching this label: ubuntu-latest". Our Forgejo runner advertises the
`docker` label (and is Docker-capable, so the container: python:3.12 step
still works); `ubuntu-latest` is a GitHub-ism it never registered. Point
runs-on at the label the runner actually has.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-30 11:44:55 +03:00

64 lines
2.4 KiB
YAML

name: docs
# Rebuild the documentation site and publish it to the `pages` branch on every
# push to main that touches the docs sources. The site is generated from the
# per-symbol source of truth in docs/language/** — nothing is hand-edited on the
# pages branch.
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'tools/docgen/**'
- '.forgejo/workflows/docs.yml'
workflow_dispatch: {}
permissions:
contents: write
jobs:
build-and-deploy:
# Match the label our Forgejo runner actually advertises. The runner is
# Docker-capable (it provides the `container:` below); `ubuntu-latest` is a
# GitHub-ism this runner does not register, so a job requesting it sits in
# "Waiting" forever with "no online runner found matching this label".
runs-on: docker
# Run in a Python image: the generator is pure-Python stdlib, and this image
# already has git for the clone + publish. No node actions are used, so the
# job never depends on the runner's base image having python installed.
container: python:3.12
steps:
- name: Generate the documentation site
env:
SOURCE_REF: ${{ github.ref_name }}
run: |
set -eu
git config --global --add safe.directory '*'
git clone --depth 1 --branch "${SOURCE_REF:-main}" \
https://git.workshopsoft.io/workshopsoft/ludic.git src
python3 --version
python3 src/tools/docgen/gen.py --out public
python3 src/tools/docgen/check.py public
echo "--- generated files ---"
ls -la public
- name: Publish to the pages branch
env:
PAGES_TOKEN: ${{ secrets.PAGES_TOKEN }}
AUTO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_SHA: ${{ github.sha }}
run: |
set -eu
TOKEN="${PAGES_TOKEN:-${AUTO_TOKEN:-}}"
if [ -z "$TOKEN" ]; then
echo "::error::No deploy token. Add a repo secret PAGES_TOKEN (write access) or enable the automatic Actions token for pushes."
exit 1
fi
cd public
git init -q -b pages
git config user.name "ludic-docs-bot"
git config user.email "docs@workshopsoft.io"
git add -A
git commit -q -m "docs: regenerate site from ${SOURCE_SHA}"
git push -f "https://ludic-docs-bot:${TOKEN}@git.workshopsoft.io/workshopsoft/ludic.git" pages
echo "published $(git rev-parse --short HEAD) to pages"