NOTE: The methodology described below has been supplanted. Now I prefer to utilize Github + Azure Pipelines + Netlify to publish this blog. The post Github + Azure Pipelines + Netlify describes this methodology.
Today I figured out how to utilize Github + Travis CI + Netlify to publish this blog. It obviously depends on the amazing work by Yihui Xie on blogdown.
I plan to document this in greater detail in the future but wanted to at least stub out my approach / requirements.
- First, I wanted to have my
masterbranch only contain the needed static files and
Rmdfiles to produce my blog.
- I then take advantage of Travis and use it to render the
blogdown::build_site(local = FALSE, method = c("html", "custom"), run_hugo = FALSE). By setting
run_hugo = FALSEI don’t utilize Hugo on Travis to build the final
- Next, I utilize a shell script to commit the just built
htmlfiles to the
publishbranch gets force pushed back to Github.
- My Netlify account is setup to look for changes on the
publishbranch rather than the
masterbranch within Github. Netlify utilizes Hugo to finish building and deploying my site.
I prefer this solution as it allows me to continue to utilize Netlify for publishing. I agree with Yihui that Netlify is a fantastic service and prefer using it over Github Pages. However, I was previously building all of my files — going from
html — on my local machine. I wanted the ability to utilize my phone or web browser to author a post and take advantage of all the various automation and CI tools to publish to the web.
Now when I want to write something, I usually start by copying a template file, adding my thoughts, removing
draft from the YAML front matter, and then committing to
As an example I added this sentence via my phone. I have the beautiful Working Copy app on my phone which I can use to manage git repos. Alternatively I could just use the Github site from my phone or any web browser.