A previous post talks about how I use Jigsaw's filtering to schedule future posts. However because Jigsaw is a static site builder I have to run Jigsaw in order to generate the HTML for the site. So if for example I have scheduled three posts to be published over three consecutive weeks I would need to build and deploy the site on each of the scheduled dates in order for the posts to be published. This kind of defeats the point of scheduling posts. So what I needed was some way to automatically trigger new builds of the site and since I use Netlify to host the site I can make use of their build hooks to do this.

For those that don't know build hooks are URLs you can use to trigger new builds and deployments in Netlify. By making a HTTP POST request to a URL, Netlify will pull down the latest master branch of your site, build it, and then deploy it.

Creating the build hook was simple. After logging into my Netlify account I went to Settings > Build & deploy > Continuous deployment > Build hooks.

Screenshot of Netlify Build Hooks

From there I clicked Add build hook where I could then provide a name and select which GitHub branch would be used to build the site.

Screenshot of Adding A Netlify Build Hook

Clicking Save creates the build hook and you are given a unique URL that can be used to trigger it.

Screenshot of Viewing a Netlify Build Hook Settings

What is very handy about Netlify is that they provide you with an example of calling the URL with cURL. With this I simply setup a cron on a server that requests this URL every Monday at 8am.

8 * * 1 curl -X POST -d {} https://api.netlify.com/build_hooks/111111111111111111111111

The result is that every week posts that have been scheduled for that day will now be published when the site is built and deployed by the build hook.