summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2020-05-26 23:12:18 +0100
committerDavid T. Sadler <davidtsadler@googlemail.com>2020-05-26 23:12:18 +0100
commitce4520943abb79167fc28ad5bd63d1f8c299f1a7 (patch)
treead8e49ce42472db81e7f902ed83ee088381e9718 /source
parent7da69211af81104309d3a007f21ad9a5ec570439 (diff)
Add Publishing Jigsaw Posts With Netlify Build Hooks
Diffstat (limited to 'source')
-rw-r--r--source/_posts/publishing_jigsaw_posts_with_netlify_build_hooks.md32
-rw-r--r--source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/001-netlify-build-hooks.pngbin0 -> 6420 bytes
-rw-r--r--source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/002-add-netlify-build-hook.pngbin0 -> 9623 bytes
-rw-r--r--source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/003-netlify-build-hook-settings.pngbin0 -> 21602 bytes
4 files changed, 32 insertions, 0 deletions
diff --git a/source/_posts/publishing_jigsaw_posts_with_netlify_build_hooks.md b/source/_posts/publishing_jigsaw_posts_with_netlify_build_hooks.md
new file mode 100644
index 0000000..e03b3eb
--- /dev/null
+++ b/source/_posts/publishing_jigsaw_posts_with_netlify_build_hooks.md
@@ -0,0 +1,32 @@
+---
+extends: _layouts.post
+section: content
+title: Publishing Jigsaw Posts With Netlify Build Hooks
+date: 2020-06-08
+description: How I use Netlify build hooks to automatically publish scheduled posts in Jigsaw
+tags: [Netlify]
+---
+
+A [previous post](/posts/2020-06-01/scheduling_posts_in_jigsaw) talks about how I use [Jigsaw's](https://jigsaw.tighten.co) 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](https://www.netlify.com/) to host the site I can make use of their build hooks to do this.
+
+For those that don't know [build hooks](https://docs.netlify.com/configure-builds/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**.
+
+<img class="ml-auto mr-auto" src="/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/001-netlify-build-hooks.png" alt="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.
+
+<img class="ml-auto mr-auto" src="/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/002-add-netlify-build-hook.png" alt="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.
+
+<img class="ml-auto mr-auto" src="/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/003-netlify-build-hook-settings.png" alt="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.
+
+```shell
+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.
diff --git a/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/001-netlify-build-hooks.png b/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/001-netlify-build-hooks.png
new file mode 100644
index 0000000..e2c553f
--- /dev/null
+++ b/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/001-netlify-build-hooks.png
Binary files differ
diff --git a/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/002-add-netlify-build-hook.png b/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/002-add-netlify-build-hook.png
new file mode 100644
index 0000000..9bb3801
--- /dev/null
+++ b/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/002-add-netlify-build-hook.png
Binary files differ
diff --git a/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/003-netlify-build-hook-settings.png b/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/003-netlify-build-hook-settings.png
new file mode 100644
index 0000000..f3a536b
--- /dev/null
+++ b/source/assets/images/2020-06-01/publishing_jigsaw_posts_with_netlify_build_hooks/003-netlify-build-hook-settings.png
Binary files differ