Upload and deploy a version to a specific environment

versions & rollback

// what it does

`-e/--env` selects a named environment block from your config, each with its own Worker name, routes, vars, and bindings; `-c/--config` points at a different config file entirely when you keep separate wrangler files per project. Every versions and rollback command accepts both, so you can roll out per environment. Use the same `-e` on upload and deploy or you'll act on the wrong Worker.

// shell

$ wrangler versions upload -e production --message "release v2"
$ wrangler versions deploy -e production <version-id>@100 -y
$ wrangler versions upload -c wrangler.staging.jsonc

// gotcha

Forgetting `-e` uploads and deploys to the top-level (default) environment, not your staging or production one — the version lands on the wrong Worker name. The chosen env also selects the matching `.env` / `.dev.vars` files.