Files
CatoandClaude Opus 5.5 12d1080388 feat: the sites engine v0 — one process serves every data site by domain
Reads Loki's sites / site_versions / site_domains with a SELECT-only role and
renders the published version with @bitbaum/sitekit's SiteDocument and the
site's theme (siteThemeCss + self-hosted faces). Answers:

- <slug>.orangecat.ch and verified own domains → the published version
- sites.orangecat.ch/<site id>/… → the preview version, never indexed
- /_sites/ask → Caddy's on-demand TLS check, falling back to hirnli's
- localhost:<port>/ → the deploy's health probe

A row that does not parse is a 404 and a log line. sitekit installs from the
kits commit until 0.8.0 is on npm.

Step 3 of loki ADR-0001 (the sites platform).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 11:42:16 +01:00

83 lines
3.3 KiB
YAML

name: CI
# WHY THIS FILE EXISTS, AND WHY IT IS NOT OPTIONAL
#
# loki's ci-gate.sh treats "CI green" and "no CI at all" identically —
# both exit 0 and let the deploy proceed. That is a sane default for a repo
# that has not set CI up yet, and it means a site WITHOUT this file deploys
# every push completely unverified while looking exactly like one that passed.
#
# Substrata shipped to production that way. So the scaffold emits this file with
# every new site: the gate has something real to wait for from the first commit.
#
# Runs the same bundle as `pnpm run verify` locally — one definition of verified.
on:
pull_request:
branches: [main]
workflow_dispatch: {}
# A newer push supersedes an older run. ci-gate.sh understands cancelled-and-
# superseded as a clean skip rather than a failure.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
# pnpm before setup-node so `cache: pnpm` can find the store.
- uses: pnpm/action-setup@v6
# action-setup's pnpm defaults its store to <pnpm bin dir>/store, i.e.
# INSIDE setup-pnpm/node_modules/.bin — and preparing a git-hosted dep
# (sitekit) in a tmp dir nested under a foreign node_modules makes its
# tsc emit TS2742 "not portable" declaration errors. Park the store
# outside any node_modules, like a normal machine.
- run: pnpm config set store-dir ~/.pnpm-store --global
- uses: actions/setup-node@v7
with:
node-version-file: '.nvmrc'
cache: pnpm
# `--frozen-lockfile` not plain install: the lockfile is the contract, and
# a resolution that drifts from it is exactly how a dependency silently
# disappears.
- run: pnpm install --frozen-lockfile
# Next keeps its compiler output in .next/cache. Without restoring it,
# every CI run recompiles the whole app from scratch — and the deploy
# then compiles it a second time. Measured across the fleet on
# 2026-09-07: of eight repos, exactly one cached this.
#
# Keyed on the lockfile so a dependency change invalidates it. The bare
# restore-key is last on purpose: a stale cache still beats no cache,
# and Next validates its own entries rather than trusting them.
- name: Cache Next.js build
uses: actions/cache@v6
with:
path: .next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
restore-keys: |
nextjs-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-
nextjs-${{ runner.os }}-
# SSOT: "verified" is defined ONCE, in package.json `verify`
# (= type-check + lint + test). Lint is real now — the Next 16 upgrade
# this file's old comment was waiting for happened on 2026-08-28.
- name: Verify
run: pnpm run verify
# The build is the real test for a content site: a broken import or a
# bad config surfaces here and nowhere earlier.
- name: Build
run: pnpm run build
# Receipt generation requires the built source to match the checked-out commit.
- name: Check build source reproducibility
run: git diff --exit-code HEAD --