Deploying to Netlify

The words "Setting Up Auto-Deploy" in white superimposed over a scened of fog covered mountains.

After I got the issue sorted out with Netlify failing to deploy, the next step is to set up a way to deploy that doesn’t involve manually triggering a deploy at GitHub.

For future me, here’s how it works:

Netlify runs a build and deploy step that is automatically triggered by any merge to master on the GitHub repository. That’s super for development and when I am making changes to the gatsby site locally and then pushing those changes to GitHub. But ideally, once I get the site built, the only time I need to deploy is when there are changes made on the WordPress side. For that, I can use a feature of Netlify called “Build Hooks.”

A Build Hook is a special URL that, when pinged, tells Netlify to go about the process of building/deploying the site. That’s super handy, because it means that I can either deploy by pushing to master on GitHub or by pinging that build hook.

Even better, there is a fantastic WordPress plugin already made that allows me to ping that Build Hook automatically based on changes made at the WordPress source site. See JAMstack Deployments by Christopher Geary.

Set up and configure that plugin by entering your build hook URL as well as the URL to your badge (which constantly updates to show you whether the build was successful on the back end of your site), and select which type of changes warrant a deploy.

This site is now client-ready! Authors, editors, and administrators can publish content, and the Gatsby site is rebuilt with every update! It’s not instantaneous, but within a minute, your Gatsby site is updated with the latest content from the WordPress site.

And it’s LIGHTNING FAST once it is deployed!