Scheduled Deploys for Future Posts

How I set up daily scheduled deploys on Netlify to publish future-dated posts automatically.

One of the small joys of running a static blog is scheduling posts in advance. Write a few pieces when inspiration strikes, set future dates, and let them publish themselves while you’re busy with other things.

There’s just one problem: static sites don’t work that way out of the box.

The problem with static sites

With a dynamic CMS like WordPress, scheduling is built in. The server checks the current time, compares it to your post’s publish date, and serves it up when the moment arrives. Simple.

Static site generators like Hugo work differently. When you build the site, Hugo looks at all your content, checks which posts have dates in the past, and generates HTML for those. Future-dated posts get skipped entirely. They don’t exist in the built output.

This means if you write a post today with tomorrow’s date, it won’t appear until you rebuild the site tomorrow. And if you’re using Netlify’s automatic deploys from Git, that rebuild only happens when you push a commit. No commit, no deploy, no post.

I could set a reminder to push an empty commit every morning. But that defeats the purpose of scheduling posts in the first place.

The solution: scheduled builds

The fix is straightforward: trigger a Netlify build automatically every day, whether or not there’s new code to deploy.

Netlify provides build hooks for exactly this purpose. A build hook is a unique URL that triggers a new deploy when you send a POST request to it. All you need is something to call that URL on a schedule.

GitHub Actions handles the scheduling side. A simple workflow with a cron trigger runs every day at midnight UK time and pings the build hook. Netlify does the rest.

The setup

First, create a build hook in Netlify:

  1. Go to your site’s dashboard
  2. Navigate to Site settings → Build & deploy → Build hooks
  3. Click Add build hook, give it a name, and select your production branch
  4. Copy the generated URL

Next, add that URL as a secret in your GitHub repository:

  1. Go to Settings → Secrets and variables → Actions
  2. Create a new repository secret called NETLIFY_BUILD_HOOK
  3. Paste the build hook URL as the value

Finally, create a workflow file at .github/workflows/scheduled-deploy.yml:

name: Scheduled Netlify Deploy

on:
  schedule:
    # Runs at 00:01 UK time (covers both GMT and BST)
    - cron: '1 0 * * *'   # 00:01 GMT (winter)
    - cron: '1 23 * * *'  # 00:01 BST (summer)
  workflow_dispatch: # Allow manual trigger

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Trigger Netlify Build
        run: curl -X POST -d {} ${{ secrets.NETLIFY_BUILD_HOOK }}

The dual cron schedule handles UK daylight saving time. During winter (GMT), the first schedule fires at midnight. During summer (BST), the second one does. There’s a brief overlap during the DST transitions where both might run, but an extra deploy is harmless.

The workflow_dispatch trigger is optional but handy. It adds a “Run workflow” button in the GitHub Actions UI, letting you trigger a deploy manually without pushing a commit.

The result

Now every morning at 00:01, GitHub Actions wakes up, pokes the Netlify build hook, and a fresh deploy rolls out. Any posts with today’s date appear automatically. No manual intervention required.

It’s a small piece of automation, but it removes just enough friction to make scheduling posts actually practical. Write when you want, publish when you planned.