One-Click Deployment for Cloudflare Workers

Getting a new platform up and running usually means wading through tutorials and documentation before you can actually build something. A more practical approach is to grab a real open-source project from GitHub and deploy it immediately. That gives you a sense of what the platform can do, beyond a "Hello, World!" example, and lets you learn from how experienced developers structure their code.

To make that process easier for Cloudflare Workers, the team has introduced Deploy Buttons. These allow you to deploy a project to the Workers platform without setting up a local development environment. Previously, new developers had to navigate between signup pages, docs, the dashboard, and the Wrangler CLI to get a project live. Now, a single click kicks off a web-based deploy tool that walks you through three short steps: connect your GitHub account, connect your Cloudflare account, and click "Deploy." The project is forked to your GitHub account and deployed via a GitHub Action.

Deploy to Cloudflare Workers

For developers looking to share their work, creating a Deploy Button for your own project is straightforward. Cloudflare has also curated a selection of projects you can try deploying now with this new flow.

Adding a Deploy Button to Your Project

To let others deploy your Workters project with one click, you need to add a GitHub Actions workflow and a button to your README.

  1. Add a workflow file to .github/workflows/ (e.g., .github/workflows/deploy.yml). It should listen for at least the repository_dispatch event—and likely push or schedule as well—and include a step for publishing with wrangler-action:
name: Build
on:
  push:
  pull_request:
  repository_dispatch:
deploy:
  runs-on: ubuntu-latest
  timeout-minutes: 60
  needs: test
  steps:
    - uses: actions/checkout@v2
    - name: Publish
      uses: cloudflare/[email protected]
  1. Ensure your repo workflow supports the CF_API_TOKEN and CF_ACCOUNT_ID environment variables:
# Update "Publish" step from last code snippet
- name: Publish
  uses: cloudflare/[email protected]
  with:
    apiToken: ${{ secrets.CF_API_TOKEN }}
  env:
    CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
  1. Add the button's Markdown to your project's README, replacing the example URL parameter with your repository's URL:
Deploy to Cloudflare Workers
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/YOURUSERNAME/YOURREPO)

Handling Paid Plan Features

If your project relies on features like Workers KV that require a paid Workers plan, you can signal that via a query parameter. Adding paid=true to the /button and deploy application paths renders a "Deploy to Workers Bundled" button and notifies users in the UI that the project requires a Bundled plan:

Deploy to Cloudflare Workers
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button?paid=true)](https://deploy.workers.cloudflare.com/?url=https://github.com/YOURUSERNAME/YOURREPO&paid=true)