Developer Platform von Cloudflare
Deploy Hooks für Workers Builds verfügbar
Workers Builds unterstützt Deploy Hooks, also eindeutige URLs pro Branch, die per HTTP-POST einen Build und Deploy auslösen, etwa aus einem CMS, per Cron Trigger oder Slack-Bot.
Workers Builds now supports Deploy Hooks — trigger builds from your headless CMS, a Cron Trigger, a Slack bot, or any system that can send an HTTP request.
Each Deploy Hook is a unique URL tied to a specific branch. Send it a POST and your Worker builds and deploys.
curl -X POST "https://api.cloudflare.com/client/v4/workers/builds/deploy_hooks/<DEPLOY_HOOK_ID>"
To create one, go to Workers & Pages > your Worker > Settings > Builds > Deploy Hooks.
Since a Deploy Hook is a URL, you can also call it from another Worker. For example, a Worker with a Cron Trigger can rebuild your project on a schedule:
export default {
async scheduled(event, env, ctx) {
ctx.waitUntil(fetch(env.DEPLOY_HOOK_URL, { method: "POST" }));
},
};
export default {
async scheduled(event: ScheduledEvent, env: Env, ctx: ExecutionContext): Promise<void> {
ctx.waitUntil(fetch(env.DEPLOY_HOOK_URL, { method: "POST" }));
},
} satisfies ExportedHandler<Env>;
You can also use Deploy Hooks to rebuild when your CMS publishes new content or deploy from a Slack slash command.
Built-in optimizations
…