|
| 1 | +# SLIM documentation |
| 2 | + |
| 3 | +MkDocs site for [agntcy/slim](https://github.com/agntcy/slim), published at [https://agntcy.github.io/slim/](https://agntcy.github.io/slim/) with a **version selector** (latest release by default, older releases in the dropdown). |
| 4 | + |
| 5 | +## Layout |
| 6 | + |
| 7 | +| Path | Purpose | |
| 8 | +|------|---------| |
| 9 | +| `content/` | Published Markdown | |
| 10 | +| `mkdocs/` | MkDocs config, uv project, theme overrides | |
| 11 | +| `Taskfile.yml` | Build, serve, lint, and local mike preview tasks | |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +- [Task](https://taskfile.dev/) |
| 16 | +- [uv](https://docs.astral.sh/uv/) |
| 17 | +- [lychee](https://github.com/lycheeverse/lychee) (required for `task docs:ci` / `task docs:test`; installed automatically in CI) |
| 18 | + |
| 19 | +Lint checks run on published nav content (`content/index.md` and `content/slim/`), not orphan pages under `content/`. |
| 20 | + |
| 21 | +## Commands (from repo root) |
| 22 | + |
| 23 | +```bash |
| 24 | +task docs:run # live preview while editing (no version dropdown) |
| 25 | +task docs:build # static site → .build/site |
| 26 | +task docs:ci # build + lint (same as PR CI) |
| 27 | +task docs:test # lint only |
| 28 | +task docs:mike:deploy-local # versioned preview on local gh-pages (no push) |
| 29 | +task docs:mike:serve # serve local gh-pages (after deploy-local) |
| 30 | +``` |
| 31 | + |
| 32 | +From `docs/`: |
| 33 | + |
| 34 | +```bash |
| 35 | +task run |
| 36 | +task -t Taskfile.yml ci |
| 37 | +``` |
| 38 | + |
| 39 | +## CI and deploy |
| 40 | + |
| 41 | +All build, lint, and deploy logic lives in [`Taskfile.yml`](Taskfile.yml). The GitHub Actions workflows are thin: they provision tools (`uv`, `task`, `lychee`) and call task entries. Dependencies come from `mkdocs/pyproject.toml` / `mkdocs/uv.lock` via `task` → `uv sync`. |
| 42 | + |
| 43 | +- [`.github/workflows/reusable-docs.yml`](../.github/workflows/reusable-docs.yml) — reusable pipeline (`workflow_call`) with a `mode` input (`ci` / `deploy-dev` / `deploy-release`); holds the shared setup + task calls. |
| 44 | +- [`.github/workflows/docs-ci.yaml`](../.github/workflows/docs-ci.yaml) — on pull requests, calls the reusable pipeline with `mode: ci`. |
| 45 | +- [`.github/workflows/docs-deploy.yml`](../.github/workflows/docs-deploy.yml) — on push to `main`, `v*.*.*` tags, releases, and manual dispatch; resolves the mode/version from the event and calls the reusable pipeline. |
| 46 | + |
| 47 | +| Trigger | Mode | Task(s) invoked | Effect | |
| 48 | +| --- | --- | --- | --- | |
| 49 | +| Pull request (touching `docs/**` or the workflows) | `ci` | `task docs:ci` | Build + lint (codespell, pymarkdown, lychee). No deploy. | |
| 50 | +| Push to `main` | `deploy-dev` | `task docs:ci` + `docs:deploy:dev` + `docs:deploy:root-files` | Build + lint, then `mike deploy --push dev` (the `dev` version). **Never touches `latest`.** | |
| 51 | +| Release published / `v*.*.*` tag / manual dispatch | `deploy-release` | `task docs:deploy:release VERSION=<v>` + `docs:deploy:root-files` | `mike deploy --push --update-aliases <version> latest` then `mike set-default latest`, so https://agntcy.github.io/slim/ opens the latest release. | |
| 52 | + |
| 53 | +Deploys use [mike](https://github.com/jimporter/mike) to push each version into a subdirectory of the `gh-pages` branch (the version ledger). `dev` is published as its own version (push to `main`) and `latest` is an alias of the newest release. With `alias_type: copy` plus `canonical_version: latest`, the `latest` alias is a full standalone copy of the release version, so both `/dev/` and `/latest/` serve content in place (HTTP 200, no redirect). Older versions stay in the dropdown; prune with `mike delete` when retiring doc releases. The `docs:deploy:*` tasks push to the remote, so they refuse to run outside CI unless `ALLOW_DOCS_PUSH=1` is set; root-file publishing reads its token from the `GH_TOKEN` environment variable (`REPO_SLUG` selects the repo). |
| 54 | + |
| 55 | +GitHub Pages serves directly from the `gh-pages` branch (**Settings → Pages → Build and deployment → Deploy from a branch → `gh-pages`**). |
| 56 | + |
| 57 | +### Local version-selector preview |
| 58 | + |
| 59 | +```bash |
| 60 | +# Optional: fetch existing versions from origin |
| 61 | +git fetch origin gh-pages |
| 62 | + |
| 63 | +task docs:mike:deploy-local # deploys the current docs to local gh-pages as `dev` (no push) |
| 64 | +task docs:mike:serve # http://127.0.0.1:8000/ with the version dropdown |
| 65 | +``` |
0 commit comments