In order to keep a consistent schedule for publishing my blog posts, I wanted to automate the process of deploying my Hugo Static Site on Netlify. By using IFTTT, I was able to set up an auto-trigger that deploys my site every morning. This method can be used not only on Netlify, but also on other providers that offer webhooks for manual deploys.
Consistency is key for maintaining momentum in my work. For the past two months, I have been posting every day from Monday to Saturday, and I plan to continue doing so in the future because I enjoy it.
I use the Hugo Static Site Generator, hosted on Netlify, and I am extremely satisfied with this blog setup.
Recently, while I was out hiking, I realized that I had missed my usual posting time and hadn’t published the scheduled blog post. With Hugo, I can set a future post date, and when the site is rebuilt using the hugo
CLI command, the post is not included in the resulting HTML. Netlify offers the convenience of building the Hugo site on their servers, so triggering a new deploy is all that’s needed. Normally, deploys happen automatically when I push something to GitHub, and Netlify deploys the changes within a minute.
However, in this particular case, I needed to manually trigger a deploy on Netlify. I logged in using my iPhone and clicked on “Trigger deploy.”
This action rebuilt the static site using Hugo on the server side, and I continued with my hike. The blog post was successfully launched, and I even tweeted about it.
While walking, I had a realization that I could automate this entire process. All I needed was a way to automatically trigger a deploy at 9AM every day. I checked the Netlify interface, hoping they had a built-in feature for recurring deploys, but unfortunately, they did not. However, they did offer a WebHook endpoint.
To accomplish my goal, I searched for a solution that allowed me to configure a daily POST to the WebHook. Initially, I used Zapier, but later switched to IFTTT, as it offered the same functionality for free.
On Netlify, I created a WebHook URL:
This provided me with a custom URL to call:
Next, I created an “applet” on IFTTT that triggers at 8AM every day:
The applet makes a web request to the deploy hook on Netlify:
By following this process, I no longer need to worry about manually deploying my blog posts. I simply create the content, push it to GitHub with the scheduled date, and the automatic deploy takes care of the rest! 🎉 👨🏼💻