Cloudflare Workers deployments for this storefront:
- Per-PR previews — handled by the Cloudflare Workers Builds GitHub App (connected on the Cloudflare side). It builds each PR and posts a sticky comment with the Commit/Branch preview URLs. No workflow file is needed.
deploy.yml— deploys to production on every push tomain.
Both workflows need the following GitHub secrets (Settings → Secrets and variables → Actions):
| Secret | Description |
|---|---|
CLOUDFLARE_API_TOKEN |
API token with Workers Scripts:Edit permission |
CLOUDFLARE_ACCOUNT_ID |
Cloudflare account ID that owns the worker |
The worker name is set in wrangler.jsonc (currently storefront-tanstack-template). Rename it in your fork to avoid colliding with other workers on the same Cloudflare account.
Per-PR previews are produced by the Cloudflare Workers Builds GitHub App, configured on the Cloudflare dashboard (not by a workflow in this repo). On each PR it builds the branch and posts a sticky comment with a Commit Preview URL (immutable, per-commit) and a Branch Preview URL (stable per branch). These are isolated versions and do not replace the production deployment.
The previous
preview.ymlworkflow was removed — it duplicated this and was failing on every PR (bun: not found, it never set up Bun). Workers Builds covers preview end to end.
Trigger: push to main.
What it does:
- Syncs
package-lock.jsonif missing/stale (commits it back to the repo asgithub-actions[bot]) - Runs
npm ci && npm run build - Runs
npx wrangler deploy --var BUILD_HASH:$(git rev-parse --short HEAD)— injects the short commit SHA as a runtime var so the worker can expose its build version
Concurrency group deploy-main with cancel-in-progress: false — queues deploys instead of cancelling, so a fast sequence of merges never leaves production mid-deploy.
wrangler.jsonc ships with routes commented out. To map a custom domain, uncomment and fill in the pattern + zone_name, then run a deploy. Until then, the worker is only reachable at <name>.<subdomain>.workers.dev.