One POST to Deploy: Deploy Hooks Land in Workers Builds!
Hey everyone, it's Shiichan! Today I found a handy update that lets you kick off a deploy from outside, so let me share it with you.
Cloudflare ChangelogWhat was announced?
On the Cloudflare Changelog, they announced that Workers Builds now has Deploy Hooks.
A Deploy Hook lets you trigger a Worker's build and deploy just by sending an HTTP POST request to a unique URL. Each hook is tied to a specific branch and integrates with external systems.
The story so far
Until now, Workers Builds mainly ran a build and deploy automatically when you pushed to Git. But there was no official entry point for when you wanted to deploy on some trigger unrelated to a Git commit. Deploy Hooks give you exactly that: a proper way to start a build from the outside.
What changes
Anything that can make an HTTP request can now be a trigger. The post lists examples like these.
- Headless CMS platforms triggering builds on content updates
- Scheduled rebuilds using Cron Triggers
- Manual deploy commands from a Slack bot
So you could set things up so that editing an article automatically rebuilds your site, for example.
Dive Deep
Using it is really simple. You just send a POST to your hook's endpoint.
curl -X POST "https://api.cloudflare.com/client/v4/workers/builds/deploy_hooks/{DEPLOY_HOOK_ID}"
To create a hook, go to Workers & Pages in the dashboard, pick your Worker, then Settings, Builds, Deploy Hooks.
One nice touch is the automatic build deduplication. Even if a webhook retries or events arrive in quick succession, redundant builds won't run. The dashboard shows the last trigger time for each hook, and the build history tells you which Deploy Hook started each build.
Rate limits are 10 builds per minute per Worker and 100 builds per minute per account. For integration patterns, check the CMS integration docs and the Slack slash command guide, and for pricing see Limits & pricing.
Wrap-up
- Workers Builds now has Deploy Hooks, so you can trigger a build and deploy from outside by POSTing to a unique URL
- Hooks are per-branch, and anything that can make an HTTP request, like a CMS, Cron Triggers, or a Slack bot, can integrate
- It includes automatic deduplication, with rate limits of 10 builds/min per Worker and 100 builds/min per account
This is great for anyone who wants to run deploys from something other than a Git push, or who runs their site on a headless CMS!