How do you deploy your workers to dev and prod?

At work we are currently deploying our first worker (filter for a GitHub -> discord webhook), and we're trying to figure out the best way to deploy it. The wrangler GitHub action seems like the obvious choice and will work for our environment (no development deployment, since that doesn't make much sense for an internal webhook filter), but left us with a few questions. What are some different ways to deploy to development and production (specifically automated methods)? I know workers support multiple "environments" but do some people use a separate account id for development?
1 Reply
Tin Cap
Tin Cap16mo ago
I use GitLab CI/CD. Just using wrangler publish. My deploy task basically looks like this:
script:
- npm install
- CLOUDFLARE_API_TOKEN=$CLOUDFLARE_API_TOKEN_WORKER_DEPLOYS npx wrangler publish --env $CF_ENVIRONMENT
script:
- npm install
- CLOUDFLARE_API_TOKEN=$CLOUDFLARE_API_TOKEN_WORKER_DEPLOYS npx wrangler publish --env $CF_ENVIRONMENT
The environment is determined by which branch triggers the build. My main branch deploys staging and my production branch deploys production. I deploy to my development environment locally
Want results from more Discord servers?
Add your server