This blog is generated by Hugo, hosted on Github Pages and uses Travis CI to glue them together.
I use two separate repositories: one for my sources, and a separate one for output. Some examples combine both in a single repository, using separate branches for sources and output; but I prefer separate repositories.
The glue is in .travis.yml
and it performs the following in order:
- Install Hugo using
go get
. - Clone the output repo into the
public
subdirectory. - Generate output using
hugo
; this overwrites existing content inpublic
. - Commit and push changes in
public
to the output repository.
To enable step 4 I clone the output repo using the https
protocol instead
of the git
protocol, and use a Github Access Token so that Travis can
push to the repo as well. The access token is configured in Travis
as an environment variable; this avoids exposing it in .travis.yml
.
I can now create my posts using Markdown, push my changes to Github, and minute or two later, they’re live!
Let me know if this method works for you, or if you have any other feedback on it.