Triggering a deploy in Netlify automatically after updating content in Strapi

I still need to write an article about hosting my portfolio. It is hosted for free. That article is coming, I promise!

But, in the meantime, I was so blown away with how easy it is to automatically deploy a static website in Netlify + Strapi that I had to share.

Netlify offers a feature called "Build hooks".

These are unique URLs that you can configure for your application to trigger deployments automatically whenever a post request is made to that endpoint.

And with Strapi, build hooks are incredibly easy to integrate.

First, go to the Netlify Deployment Settings in your project, and find the area for Build hooks.

There, you will have an option to create a new build hook. Give it a memorable name, and click save.

Adding a build hook in Netlify

Then, copy the URL that is configured for that build hook.

Once that is done, You will want to add the build hook as a webhook in the Strapi Admin panel.

You can do this by going to "Settings > Webhooks" within Strapi.

Once you are in the Webhooks panel, add a new webhook for the URL that you just configured in Netlify.

Strapi webhook panel

You will want to add the appropriate URL and configure the settings to your liking.

Paste the URL that you copied from Netlify into the URL field, give the webhook a memorable name, and choose the appropriate settings for when you want to publish your changes automatically!

Isn't that cool?

Once you save your changes, go ahead and try updating some content on your site and see the wonder!

Chris Wray website logo

Trying to do my part in making the world a better place.

This site is hosted for free, so I am thanking the services I am using by adding a link to their websites here in the footer.

© 2020 Chris Wray. All rights reserved.