Files
CatoandClaude c83c8f473e feat(starter): kickoff and new-site.sh both produce the fleet starter (#1138)
scripts/site-template is now bitbaum/fleet templates/app — Next.js 16,
better-auth accounts (password, link, passkey, 2FA, OrangeCat/bitbaum sign-in
as env-gated OIDC), en/de/fr, nonce CSP, ai-kit/mail-kit/limitkit/bip-kit,
tests and CI — copied at a pinned fleet commit by
scripts/templates/sync-starter.sh. CI proves the copy is exact
(sync-starter.sh --check), and starter-sync.yml opens the PR when fleet's
starter moves. Never edited here.

The kickoff's "nextjs-tailwind" starter seeds the same app from
src/lib/starter-app.generated.ts (generated from the directory, pinned by
scripts/test/starter-app.ts), minus the workflows register-site.sh adds with
the site's CD. The repo is seeded in one Trees API call with inline contents
instead of a blob POST per file (~85 for this starter). The widget token rides
in .env.production; the starter's .gitleaks.toml allows NEXT_PUBLIC_* values.
The new-from-scratch picker reads the light template list, so the starter's
file bodies never reach a client bundle.

Both paths give the site its database and auth/seal secrets ON THE BOX
(scripts/hetzner/provision-db-on-box.sh: role + database, ~/.db-credentials,
/opt/<slug>/shared/.env; existing secrets never replaced; nothing printed), and
record the db in the register row so every deploy applies drizzle/.
register-site.sh seeds the starter's full workflow set to starter repos and
the golden CI floor to anything else, never overwriting another repo's ci.yml.

test-site-template.sh follows the starter (verify SSOT, design tokens instead
of a local palette) and its comment stripper is fixed: the sed range deleted
the page from the doc comment to EOF, so every day-zero check had been passing
against an empty string. check-template-contrast.mjs and the starter-lock
generator are retired with the files they checked.


Claude-Session: https://claude.ai/code/session_01W7K2Gm5wcbfCi7THtmV1Hy

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 13:39:14 -07:00

115 lines
3.8 KiB
YAML

name: CI
# "Verified" is defined ONCE, in package.json `verify` (format, lint,
# typecheck, unit tests, build), and run here verbatim — green locally means
# green here. The integration job adds what verify cannot do hermetically:
# the real Postgres schema and the real auth flow, end to end.
#
# Without this file Loki's deploy gate treats "no CI" like "CI green" and
# every push would deploy unverified.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: {}
# On main the group is keyed per COMMIT: a newer merge must never cancel an
# older commit's run, because deploys key off that run (fleet templates/ci).
concurrency:
group: ci-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.sha || 'branch' }}
cancel-in-progress: true
permissions:
contents: read
env:
NEXT_TELEMETRY_DISABLED: "1"
jobs:
verify:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
# pnpm BEFORE setup-node: `cache: pnpm` needs the binary. No `version:`
# input — package.json `packageManager` is the one source.
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: ".nvmrc"
cache: pnpm
- run: pnpm install --frozen-lockfile
# Next keeps its compiler output in .next/cache and verify BUILDS; keyed
# on the lockfile so a dependency change invalidates it.
- 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 }}-
- name: Verify
run: pnpm run verify
integration:
runs-on: ubuntu-latest
timeout-minutes: 15
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: app
POSTGRES_PASSWORD: app
POSTGRES_DB: app_test
ports: ["5432:5432"]
options: >-
--health-cmd "pg_isready -U app -d app_test"
--health-interval 5s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: ".nvmrc"
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Accounts against a real Postgres
env:
DATABASE_URL: postgres://app:app@localhost:5432/app_test
run: pnpm run test:integration
# A sweep merge uses GITHUB_TOKEN, and a push made with that token triggers
# no workflows; the CI the sweep re-arms is a dispatch whose workflow_run
# GitHub also suppresses. So after an auto-merge nothing would start Deploy
# until the sweep's reconciler tick. A dispatch is not a push, so this job
# starts Deploy the moment CI proves main green — only for workflow_dispatch,
# since a real push chains through workflow_run by itself.
ship:
needs: [verify, integration]
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
# contents: read is not optional: a job-level block turns everything it
# does not list OFF, and a private repo then cannot check itself out.
permissions:
actions: write
contents: read
steps:
- uses: actions/checkout@v7
- name: Dispatch Deploy now that main is green
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -f .github/workflows/deploy.yml ]; then
gh workflow run deploy.yml --ref main
else
echo "no deploy.yml — this repository does not deploy yet"
fi