Deploy docs site has failed on every push to main since before 2026-08-18. It ran `pnpm --filter @lawsynth/docs-site run render` directly, which only builds docs-site itself — never its workspace deps `@lawsynth/world-schema` and `@lawsynth/world-viewer`, whose package.json `exports` point at `./dist/src/index.*` which only exists after each package's own `tsc` build runs. `pnpm install` just symlinks workspace packages, it doesn't build them, so tsc failed with TS2307 (cannot find module) every time. pr.yml's `typescript` job never hit this because it calls the root `build` script (`pnpm -r --if-present run build && pnpm --filter @lawsynth/docs-site run render`), which builds every workspace package in topological order first — that's why PR checks passed while deploys kept failing. Fix: add the same `pnpm -r --if-present run build` step to deploy-site.yml before the render step, mirroring the root build script. Verified locally: `pnpm -r --if-present run build` builds all 10 packages in order, then `pnpm --filter @lawsynth/docs-site run render` renders 330 files successfully (previously failed in ~13s with TS2307). This is unrelated to PR #9's merge-conflict-marker fix — that issue was already independently resolved on main in 760bc7e (2026-10-17).
61 lines
2.4 KiB
YAML
61 lines
2.4 KiB
YAML
name: Deploy docs site
|
|
|
|
# Builds the deterministic static documentation site and publishes it to
|
|
# Cloudflare Pages (lawsynth.dev). Runs on pushes to `main` that touch the site
|
|
# or its inputs, and can be triggered manually.
|
|
#
|
|
# Requires two repository secrets (Settings -> Secrets and variables -> Actions):
|
|
# CLOUDFLARE_API_TOKEN - a token with the "Cloudflare Pages: Edit" permission
|
|
# CLOUDFLARE_ACCOUNT_ID - the account that owns the `lawsynth` Pages project
|
|
# If either secret is absent the deploy step is skipped (the build still runs),
|
|
# so forks and PRs never fail on missing credentials.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "apps/docs-site/**"
|
|
- "packages/world-schema/**"
|
|
- "packages/world-viewer/**"
|
|
- ".github/workflows/deploy-site.yml"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: deploy-site-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: pnpm
|
|
- run: pnpm install --frozen-lockfile
|
|
# Build workspace dependencies first (@lawsynth/world-schema,
|
|
# @lawsynth/world-viewer, etc.) so their dist/ output exists before
|
|
# docs-site's tsc build resolves them. `pnpm --filter ... run render`
|
|
# alone only builds docs-site itself, not its workspace deps, which is
|
|
# what broke every deploy since 2026-08-18 (TS2307: cannot find module).
|
|
# This mirrors the root "build" script used by pr.yml's typescript job.
|
|
- run: pnpm -r --if-present run build
|
|
# Emits the static tree to apps/docs-site/public (self-contained HTML +
|
|
# sitemap/robots/_headers). Deterministic; see apps/docs-site/DEPLOY.md.
|
|
- run: pnpm --filter @lawsynth/docs-site run render
|
|
- name: Publish to Cloudflare Pages
|
|
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' }}
|
|
uses: cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: pages deploy apps/docs-site/public --project-name=lawsynth
|