Deployment
The project deploys to Cloudflare Workers via two GitHub Actions workflows.
Workflows
| Workflow | Trigger | Job |
|---|---|---|
.github/workflows/ci.yml | every PR + push to main | lint, typecheck, tests, dry-run build |
.github/workflows/deploy.yml | push to main | bun run build → wrangler deploy |
.github/workflows/docs.yml | push to main touching docs/** | VitePress build → GitHub Pages |
Required GitHub secrets
| Secret | Used by | Notes |
|---|---|---|
CLOUDFLARE_API_TOKEN | deploy.yml | needs Workers Scripts:Edit, D1:Edit, KV:Edit |
CLOUDFLARE_ACCOUNT_ID | deploy.yml | account that owns the Worker |
wrangler.jsonc is checked in with the real D1 and KV ids — no secret substitution happens in CI any more.
Worker secrets (set once, not via CI)
bunx wrangler secret put RIOT_API_KEYSet the value to a production Riot API key once you have one. Until then, the dev-key rate limits (20 req/s, 100 req/2 min) apply, which makes Tier 2's cold path slow.
First-time provisioning
- Create the D1 database (if it doesn't exist):bashCopy the
bunx wrangler d1 create mmr-calculator-dbdatabase_idintowrangler.jsonc. - Apply migrations to production:bash
bunx wrangler d1 migrations apply mmr-calculator --remote - Create the KV namespace (if it doesn't exist):bashPaste the returned id into
bunx wrangler kv namespace create CACHEwrangler.jsoncunderkv_namespaces[0].id. - Set the Riot API key:bash
bunx wrangler secret put RIOT_API_KEY - First deploy: push to
main. The workflow runsbun run buildthenwrangler deploy.
Custom domain
wrangler.jsonc does not yet declare a route. Once the Worker is live, point the desired hostname at it via the Cloudflare dashboard (Workers Routes) or by adding a routes entry to the wrangler config.
Troubleshooting
The entry-point file at "apps/web/.svelte-kit/cloudflare/_worker.js" was not found. The deploy workflow is missing the build step. The current deploy.yml runs bun run build before wrangler deploy; if you forked it, make sure your variant does the same.
Workers KV: namespace not found The placeholder KV id is still in wrangler.jsonc. Run the create command above and paste the real id in.
Cron triggers not firing Confirm in wrangler.jsonc that triggers.crons is set, and that the post-build injector actually wrote _cron.js into apps/web/.svelte-kit/cloudflare/. The inject-do.mjs script is idempotent and skips work if _worker.js already contains the markers.
Docs site
docs.yml builds the VitePress site from docs/ and publishes it to GitHub Pages on every push to main that touches docs/**. Enable GitHub Pages with source "GitHub Actions" once before the first publish; after that the workflow is hands-off.