Continuous deployment to GitHub Pages
Turned out Travis CI can deploy static websites to GitHub Pages without any hassle. Luckily to me, I’d already been using a Makefile to build this website, so it took a few minutes to set it all up.
First, I had to generate a new access token for Travis CI with the
public_repo scope and hand it to Travis as a secret variable named
GITHUB_TOKEN in the repository settings.
Then, I created
It commands Travis to execute
make build to build the website. If it goes well, the Makefile creates the static directory (see
local-dir option) with the contents of the website. Then Travis checks if the current branch is
master and uploads the contents of
target-branch (defaults to
That was it. Now I can edit files directly on GitHub.com (you can also) and any changes made there will get deployed in a matter of minutes.