how to · unni-web

How to: deploy the Unni sites

Goal

Every site in the monorepo deploys on its own Cloudflare Pages project, from the same GitHub repo, without touching the others.

Prerequisites

  • A Cloudflare account with Pages enabled.
  • The repo on GitHub.
  • For the auto-deploying sites: permission to install the Cloudflare GitHub App.
  • For Direct Uploads projects: a Cloudflare API token with Pages:Edit, stored as a GitHub secret.

Steps

  1. Build and verify locally.
npm run check
pwsh -NoProfile -File ./scripts/scrub-check.ps1
  1. Create one Pages project per site, with:
Setting Value
Project name unni-<site>
Production branch main
Root directory sites/<site>
Build command node build.js
Output directory dist
  1. Connect the project to the GitHub repo at creation time. A Direct Uploads project cannot be converted later.

  2. For a Direct Uploads project that must stay live, add the repo secrets and deploy with Wrangler:

gh secret set CLOUDFLARE_API_TOKEN
gh secret set CLOUDFLARE_ACCOUNT_ID --body <account-id>
gh workflow run deploy-games.yml --ref main
gh run watch <run-id> --exit-status
  1. Verify the live page, not just the build.
(Invoke-WebRequest https://unni-root.pages.dev/).StatusCode

Result

Each site has its own *.pages.dev URL, its own deployment history and its own rollback point. A push to main rebuilds the connected projects.

Notes

  • node build.js is the entry point even when a site uses another tool. The research site’s build.js syncs the shared CSS and then runs Astro, so the Pages build command stays the same.
  • The build image needs a recent Node. Astro 7 requires Node 22.23 or newer; set NODE_VERSION in the Pages project if the default is older.