Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build

# Railway deploys main itself, through its GitHub integration. This workflow checks that
# every pull request and every push to main builds.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

# A newer push supersedes an in-flight check on the same branch.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
# Railway builds from the Dockerfile too, but a red check here points at the actual
# error rather than at a remote build log.
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm

- run: npm ci

# The route table and search index are generated and gitignored, so they must exist
# before tsc runs — a fresh checkout has neither.
- name: Generate routes and search index
run: npm run gen

- name: Typecheck
run: npx tsc --noEmit

- name: Heading anchors match the previously published site
run: node scripts/test-slug.mjs

- name: Build
run: npm run build

- name: Every page prerendered
run: |
count=$(find dist -name index.html | wc -l)
echo "prerendered $count pages"
test "$count" -ge 35
133 changes: 0 additions & 133 deletions .github/workflows/deploy.yml

This file was deleted.

21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ Images go in `public/images/` and are referenced from `.mdx` as `/images/…`.
- **Netlify / Cloudflare Pages** — the generated `dist/_redirects` is already correct
- **S3 + CloudFront** — index document `index.html`, error document `404.html`, plus a rule
mapping `/path` to `/path/index.html`
- **Railway** — pushes to `main` deploy automatically via
`.github/workflows/deploy.yml`; `railway up` from this directory does it by hand.
`railway.json` selects the Dockerfile.
- **Railway** — pushes to `main` deploy automatically through Railway's GitHub
integration; `railway up` from this directory does it by hand. `railway.json` selects the
Dockerfile.

Assets under `/assets/` and `/fonts/` are content-hashed or never edited in place and are served
`immutable`; HTML revalidates.
Expand Down Expand Up @@ -121,17 +121,12 @@ smears every stem.

## CI

`.github/workflows/deploy.yml`:
`.github/workflows/build.yml` runs on pull requests to `main` and on pushes to `main`:
`npm run gen`, `tsc --noEmit`, the anchor test, `npm run build`, and an assertion that at
least 35 pages prerendered.

- **pull requests to `main`** — build check only: `npm run gen`, `tsc --noEmit`,
the anchor test, `npm run build`, and an assertion that all 35 pages prerendered.
- **pushes to `main`** — the same check, then `railway up`, then it waits until the live
`index.html` byte-matches this commit's build and smoke-tests four routes plus a 404.
Deploys never run from a pull request.

Requires one repository secret, **`RAILWAY_TOKEN`** — a Railway *project* token for the
`production` environment (Railway dashboard → project → Settings → Tokens). Without it the
deploy job fails immediately with a message saying so, rather than half-deploying.
Deploying is not part of CI. Railway's GitHub integration builds the Dockerfile and deploys
every push to `main`.

## Verifying the rendering

Expand Down
Loading