Cloudflare Hosting & CI Setup
How the doc/ site is hosted on Cloudflare Workers, and the human step that turns on CI deploys.
Status: fully configured
CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID are both set, and the pipeline is verified end-to-end — production and PR previews both deploy from CI. The manual token steps below are kept as the runbook for rotating the token or re-creating it in another repo.
What's already configured
Hosting. The site deploys to Cloudflare Workers static assets (
doc/, worker namewrangler. toml zudo-led-lamp), served at the custom domainhttps:. The/ / zudo- led- lamp. takazudomodular. com/ [[routes]]/custom_domain = trueentry andworkers_dev = trueare fully declarative — a plainwrangler deployattaches both the custom domain and the*.workers.devsubdomain on its own; no manual Cloudflare API call is needed. This was verified with the first production deploy (done manually from an OAuth-authenticated localwrangler, from this worktree) — the site is already live.doc/setszfb. config. ts siteUrlto the same host as thewrangler.tomlroute, andadapter: "@takazudo/zfb-adapter-cloudflare"sopnpm buildemitsdist/._ worker. js Versions are pinned.
doc/pinspackage. json wrangleras an exact devDependency andpackageManager(pnpm). CI resolves the wrangler version it runs from that pin, so awranglerupgrade is a normal dependency bump, not a silent CI drift..— on every push togithub/ workflows/ main- deploy. yml mainthat touchesdoc/: install, type check, build, then deploy to production..— on every PR targetinggithub/ workflows/ pr- checks. yml mainor abase/**worktree branch that touchesdoc/: install, type check, build, then deploy a preview (wrangler versions upload --preview-alias pr-<N>) and post/update a sticky PR comment with the preview URL.Secret gating. Both workflows read a secret-readiness step before touching Cloudflare — if
CLOUDFLARE_API_TOKENisn't set yet, the deploy/preview steps are skipped with an explicit::notice::, and the job still finishes green. Nothing goes red just because the token is missing.CLOUDFLARE_ACCOUNT_IDrepo secret is already set (fromwrangler whoamion an authorized local session).
The manual token step (done — kept as a runbook)
CI cannot deploy or produce PR previews until CLOUDFLARE_API_TOKEN exists as a repo secret. This has been done; the steps remain here for rotating the token, since creating one needs a human with Cloudflare dashboard access:
Go to Cloudflare Dashboard → My Profile → API Tokens → Create Token.
Use the "Edit Cloudflare Workers" template. It already grants
Account → Workers Scripts → EditandZone → Workers Routes → Edit— the pairwrangler deployneeds to both upload the worker and attach the custom domain declared inwrangler.toml(no separate Cloudflare API "cutover" step exists in this repo; the domain attach happens throughwrangler deployitself). When the token-creation UI asks for Zone Resources, make sure it includestakazudomodular.com— a token scoped to "All zones from an account" or explicitly excluding that zone will fail the domain attach with a permission error.Set the secret:
gh secret set CLOUDFLARE_API_TOKEN --repo Takazudo/zudo-led-lamp
Smoke test
Open any pull request that touches doc/. Expect pr-checks.yml to post a sticky comment on the PR:
Before the token exists: the comment says "Preview pending" — this is expected, not a bug.
After the token exists: the comment updates in place with a working
https:preview link./ / pr- <N>- zudo- led- lamp. <subdomain>. workers. dev
Either way, the PR check itself should be green — only the presence of a working preview link changes.