<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx" -->

---
title: How I auto-publish scheduled posts with a Cloudflare...
description: A practical walkthrough of auto-publishing scheduled posts on a static Astro site hosted on Cloudflare Pages. The approach uses a Cloudflare Worker with a cron...
canonical: https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How I auto-publish scheduled posts with a Cloudflare Worker cron | daily.dev
og:description: A practical walkthrough of auto-publishing scheduled posts on a static Astro site hosted on Cloudflare Pages. The approach uses a Cloudflare Worker with a cron...
og:url: https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx
og:image: https://api.daily.dev/og/posts/0tvkhx5nx.png
og:image:alt: How I auto-publish scheduled posts with a Cloudflare Worker cron
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How I auto-publish scheduled posts with a Cloudflare Worker cron

**[Flavio Copes](https://daily.dev/sources/flaviocopes)** · 4 min read · 2 upvotes · 0 comments

## Summary

A practical walkthrough of auto-publishing scheduled posts on a static Astro site hosted on Cloudflare Pages. The approach uses a Cloudflare Worker with a cron trigger to POST a deploy hook every morning, replacing an unreliable GitHub Actions cron that ran hours late. A DST-proof trick registers two UTC cron times and uses the Intl.DateTimeFormat API to check the local wall-clock time before firing the actual rebuild, eliminating manual updates when clocks change.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://flaviocopes.com/scheduled-cloudflare-pages-rebuilds>

## Questions this post answers

### How can I automatically publish future-dated blog posts on a static site hosted on Cloudflare Pages?

Set up a Cloudflare Worker with a scheduled cron trigger that sends a POST request to a Cloudflare Pages deploy hook every morning, which rebuilds the site so any post whose date has passed goes live. This solves the problem where Pages only builds on a git push, so a future-dated post never publishes unless a new build happens after its date.

_daily.dev surfaces practical Cloudflare Workers patterns for developers automating static site deploys._

### Why did my GitHub Actions scheduled cron job run hours later than the time I set?

GitHub Actions cron scheduling is best-effort, not exact: a job scheduled for 05:15 UTC was observed running at 07:40, 08:34, 08:42, and 10:07 on different days. GitHub runs scheduled workflows when it has spare capacity, and busy times of day cause delays, making it unreliable for time-sensitive tasks like publishing content on schedule.

_developers debugging flaky CI schedules can compare cron reliability across platforms on daily.dev._

### How do I keep a Cloudflare Worker cron trigger running at the same local wall-clock time across daylight saving time changes without editing the cron expression?

Register two cron triggers in wrangler.jsonc, one for each UTC offset the target timezone uses across the year (for example 30 7 * * * and 30 8 * * * for 09:30 Europe/Rome time), then inside the scheduled handler format the current time in that timezone using Intl.DateTimeFormat and only proceed if it equals the target wall-clock time. Both crons fire daily; the one matching the wrong offset does nothing.

_anyone scheduling timezone-sensitive jobs can find similar cron and DST workarounds on daily.dev._

## Similar posts on daily.dev

- [How to rebuild a Cloudflare site on a schedule](https://daily.dev/posts/how-to-rebuild-a-cloudflare-site-on-a-schedule-ihah9qwcf) · Flavio Copes · 0 upvotes · 1 comments
- [Cloudflare Cron Triggers: run a Worker on a schedule](https://daily.dev/posts/cloudflare-cron-triggers-run-a-worker-on-a-schedule-allyxbppi) · Flavio Copes · 0 upvotes · 0 comments
- [Drain Payload’s Schedule Queue on Serverless, End to End](https://daily.dev/posts/drain-payload-s-schedule-queue-on-serverless-end-to-end-fvn0xqsmt) · Medium · 0 upvotes · 0 comments
- [How to Build a Headless WordPress Frontend with Astro SSR on Cloudflare Pages](https://daily.dev/posts/how-to-build-a-headless-wordpress-frontend-with-astro-ssr-on-cloudflare-pages-30hassk3l) · freeCodeCamp · 3 upvotes · 0 comments
- [Stitcher.io](https://daily.dev/posts/stitcher-io-jgdolzw3r) · stitcher.io · 44 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#general-programming](https://daily.dev/tags/general-programming), [#cloudflare](https://daily.dev/tags/cloudflare), [#astro](https://daily.dev/tags/astro)

[View this post on daily.dev](https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How I auto-publish scheduled posts with a Cloudflare Worker cron","url":"https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx"},"datePublished":"2026-08-04T11:00:03.619Z","dateModified":"2026-09-14T09:00:05.162Z","description":"A practical walkthrough of auto-publishing scheduled posts on a static Astro site hosted on Cloudflare Pages. The approach uses a Cloudflare Worker with a cron...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7219243bb6b6113ecc90bd933965a4ef?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7219243bb6b6113ecc90bd933965a4ef?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Flavio Copes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Flavio Copes","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1f2dbd275797411bbd37bfdaaf0951a9","url":"https://daily.dev/sources/flaviocopes"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,general-programming,cloudflare,astro","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Flavio Copes","item":"https://daily.dev/sources/flaviocopes"},{"@type":"ListItem","position":3,"name":"How I auto-publish scheduled posts with a Cloudflare Worker cron"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-i-auto-publish-scheduled-posts-with-a-cloudflare-worker-cron-0tvkhx5nx#faq","mainEntity":[{"@type":"Question","name":"How can I automatically publish future-dated blog posts on a static site hosted on Cloudflare Pages?","acceptedAnswer":{"@type":"Answer","text":"Set up a Cloudflare Worker with a scheduled cron trigger that sends a POST request to a Cloudflare Pages deploy hook every morning, which rebuilds the site so any post whose date has passed goes live. This solves the problem where Pages only builds on a git push, so a future-dated post never publishes unless a new build happens after its date. daily.dev surfaces practical Cloudflare Workers patterns for developers automating static site deploys."}},{"@type":"Question","name":"Why did my GitHub Actions scheduled cron job run hours later than the time I set?","acceptedAnswer":{"@type":"Answer","text":"GitHub Actions cron scheduling is best-effort, not exact: a job scheduled for 05:15 UTC was observed running at 07:40, 08:34, 08:42, and 10:07 on different days. GitHub runs scheduled workflows when it has spare capacity, and busy times of day cause delays, making it unreliable for time-sensitive tasks like publishing content on schedule. developers debugging flaky CI schedules can compare cron reliability across platforms on daily.dev."}},{"@type":"Question","name":"How do I keep a Cloudflare Worker cron trigger running at the same local wall-clock time across daylight saving time changes without editing the cron expression?","acceptedAnswer":{"@type":"Answer","text":"Register two cron triggers in wrangler.jsonc, one for each UTC offset the target timezone uses across the year (for example 30 7 * * * and 30 8 * * * for 09:30 Europe/Rome time), then inside the scheduled handler format the current time in that timezone using Intl.DateTimeFormat and only proceed if it equals the target wall-clock time. Both crons fire daily; the one matching the wrong offset does nothing. anyone scheduling timezone-sensitive jobs can find similar cron and DST workarounds on daily.dev."}}]}
```

