How I deploy my Jigsaw blog to Github Pages
Martin Betz • February 28, 2020
I use Tighten's Jigsaw to build this website and blog. I used to host it on Netlify and let it build it as well. But as I make many granular edits and the build taking two 2 minutes, I was looking for a quicker alternative where I just push the output HTML files instead of the source files. Turns out that Github Pages is what I looked for.
Since I had some problems setting it up, here is my final working solution:
- For every now post, I create a feature branch, say
- When done, I go to master and merge:
gcm && gm add-article-jigsaw-github-pages-deployment(using
- Then I check out a running branch called
gh-pages. I do not want the changes to the HTML in my master, so I just save them here
gh-pagesI first rebase to put the output HTML commits ahead of master:
- If rebasing causes trouble, I just force delete the
gb -D gh-pages) and create it afresh (its only purpose is to keep my master branch clean by not versioning the production output files)
- Then I run Jigsaw:
npm run production
- Next I create a bump commit with date and running number:
ga . && gcmsg "Bump: 200128-001"
- Then I force push just the subdirectory
build_productionwith the following command to my
git push github `git subtree split --prefix build_production`:gh-pages --force
- I also have an alias for that in my
ghpmb(where mb stands for martinbetz)
- That's it!