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
- Clone the output repo into the
- Generate output using
hugo; this overwrites existing content in
- Commit and push changes in
publicto the output repository.
To enable step 4 I clone the output repo using the
https protocol instead
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
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.