Skip to content
Latchkey

wrangler deploy Command Reference

Publish a Cloudflare Worker to an environment.

wrangler deploy uploads and activates a Cloudflare Worker defined by your wrangler.toml. It is the current command name that replaced the older wrangler publish.

What it does

wrangler deploy bundles your Worker, uploads it to Cloudflare, and routes traffic to the new version per the routes and triggers in wrangler.toml. It supports named environments so one config can target staging and production.

Common flags and usage

  • --env NAME: deploy a named environment from wrangler.toml
  • --name NAME: override the Worker name
  • --minify: minify the bundle before upload
  • --dry-run: build without uploading
  • CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID authenticate the deploy

Example

shell
- name: Deploy Worker
  env:
    CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
  run: npx wrangler deploy --env production --minify

In CI

Set CLOUDFLARE_API_TOKEN (scoped to Workers) and CLOUDFLARE_ACCOUNT_ID from secrets; wrangler reads them automatically and runs non-interactively. Use --env to keep staging and production separate in one wrangler.toml, and --dry-run on PRs to validate the build without shipping.

Key takeaways

  • wrangler deploy uploads and activates a Cloudflare Worker.
  • It is the current name for what used to be wrangler publish.
  • Authenticate with a scoped CLOUDFLARE_API_TOKEN and account id from secrets.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →