onset-web — Staging / Production Environments¶
Marketing site + Cloudflare Pages Functions. Supabase-backed routes (/protocols,
/fitness, /p/..., /f/..., download counters) read env vars at runtime.
| Branch / deploy | Cloudflare scope | Supabase backend |
|---|---|---|
main (production) |
Production bindings (wrangler [vars] at deploy) |
R940 https://onset-api.theonset.app |
develop (preview) |
Preview env vars | Staging project (see GitHub STAGING_SUPABASE_* secrets) |
Deploy pipelines¶
main→.github/workflows/cloudflare-pages.yml→ production deploydevelop→.github/workflows/cloudflare-pages-preview.yml→ preview deploy (--branch develop)
Cloudflare dashboard: Workers & Pages → onset-web → Settings → Builds → set
Production branch to main only. Do not enable automatic Git builds for
develop — GHA is the sole develop deploy path. A parallel Cloudflare Git build
races GHA and can repoint develop.onset-web.pages.dev at a prod-backed deployment.
Production deploys are not triggered from develop. Preview deploys use Cloudflare's
Preview environment variable scope (staging Supabase).
One-time: Preview environment variables¶
Pages Functions need these names (see .dev.vars.example):
| Variable | Preview (staging) value |
|---|---|
SUPABASE_URL |
https://lzpyfohgfdohrtlamzek.supabase.co |
SUPABASE_ANON_KEY |
staging anon JWT (Dashboard → API → anon public) |
SUPABASE_SERVICE_ROLE_KEY |
staging service-role JWT (download counters only) |
Option A — GitHub Actions (recommended)¶
Repo secrets (Settings → Secrets → Actions):
STAGING_SUPABASE_URLSTAGING_SUPABASE_ANON_KEYSTAGING_SUPABASE_SERVICE_ROLE_KEY
(CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are already configured.)
The develop deploy workflow injects these into wrangler.toml as
[env.preview.vars] at deploy time (required because this repo sets
pages_build_output_dir — dashboard Preview scope alone is not enough for
wrangler pages deploy direct uploads).
Configured. Optional: run Actions → Configure Cloudflare Preview env if you also use Cloudflare Git-connected preview builds. Re-run after rotating staging keys.
Preview URL: https://develop.onset-web.pages.dev
Option B — Cloudflare Dashboard¶
Workers & Pages → onset-web → Settings → Environment variables → Preview tab.
Add the three Supabase variables above. Leave Production on prod values.
Local dev against staging¶
Promotion flow¶
New Supabase migrations: staging first, then prod (see Onset/docs/ENVIRONMENTS.md).