Run deploy commands as explicit recipes with expected files and effects
Use build, dry-run, production deploy, named preview deploy, same-worker preview upload, cleanup, and GitHub Actions as separate recipes with visible effects.
Deploy docs should start from commands a developer can copy and the artifacts or remote effects they should expect, then move caveats into boundary notes after the working recipe.
- Best for
- Shipping without guessing target or cleanup behavior
- Local artifacts
- and
- Remote effects
- Only deploy commands with explicit targets touch Cloudflare
Command recipes
| Task | Command | Expected result |
|---|---|---|
| Build local artifacts | Writes deploy-ready generated output; does not touch Cloudflare. | |
| Inspect compiled config | Prints Wrangler-facing config for review. | |
| Dry-run production deploy | Exercises deploy planning without uploading. | |
| Production deploy | Uploads to the stable production Worker name. | |
| Same-worker preview upload | Uses Cloudflare same-worker preview behavior and synthetic preview scope. | |
| Named preview scope | Uses explicit preview scope for resource naming, logs, and cleanup. | |
| Inspect preview bindings | Shows resolved preview resources and worker references. | |
| Clean preview resources | Deletes preview-owned resources and dedicated preview workers when applicable. |
Same-worker preview vs named preview scope
| Model | Use when | Tiny example |
|---|---|---|
| Same-worker preview | You want Cloudflare preview upload behavior and do not need a human-named resource scope. | |
| Named preview scope | You want logs, resource names, cleanup, and GitHub feedback tied to a visible name. | |
| Branch-scoped worker family | Durable Objects, queues, crons, or service topology need stronger isolation. | plus dedicated preview worker naming |
Preview resource lifecycle by feature
| Feature | Lifecycle stance |
|---|---|
| KV, D1, R2, Queues, Vectorize | Can be preview-scoped and managed when authored with preview-aware names. |
| Services and Durable Objects | Worker naming and migrations require explicit preview strategy; cleanup can remove preview-only workers. |
| Analytics Engine and Browser Rendering | Reported as warnings because there is no ordinary account resource to delete. |
| Hyperdrive | Cleanup can remove existing preview configs, but database ownership stays product-owned. |
| AI, Images, Media, Containers | Product-owned remote behavior; use smoke tests and usage limits rather than pretending local cleanup owns the product. |
Minimal GitHub Actions preview workflow
Preview workflow
name: Preview
on:
pull_request:
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/devflare-setup-workspace
- uses: ./.github/actions/devflare-deploy
with:
working-directory: packages/app
target: preview
preview-scope: pr-${{ github.event.pull_request.number }}
- uses: ./.github/actions/devflare-github-feedback
with:
preview-scope: pr-${{ github.event.pull_request.number }}
Previous
GitHub workflows
Devflare ships reusable GitHub Actions for setup, impact checks, deploy execution, and feedback, plus supported workflow strategies for validation, previews, production, and cleanup.
Next
Production deploys
Production uses or , preview uses or . No target means no deploy.