Site Navigation:

This site is 100% open source.

Creative Commons License

pipeline status
A technology blog with updates about my projects,
as well as interesting tricks, tips, news, and tutorials.

Automatically Building My Website With Travis CI

10 May 2015

TravisCI In order to simplify the publication of content and have this site automatically build whenever I publish a change to Git, I have set up a script and integrated my GitHub repository with Travis CI. By doing so, I can simply focus on the content, and using the scripts that I wrote, the site will build and publish itself. Because I have a cron job setup on the domain, every change I push to Git is automatically pulled and deployed almost instantaneously, so that my content is up to date.

The setup for this is actually pretty simple, although it took me a few tries to figure it out – first and foremost, there is now no longer a in the repository’s main directory. This file was previously used to manually build and copy the files for Jekyll as well as clear memcached’s cache when I rebuilt the site so that nginx would always be serving the latest content. The lines that were in that file were manually copied to a .travis.yml file which will build the site automatically and push the changes to GitHub as me, with a “built from [commit]” line as the commit message. Before building the site, the script downloads and installs the ruby development libraries into the Travis build environment and installs jekyll using Ruby gems.

Once the build environment is setup properly, the script will build all the non-blog static content by running my, which is custom Python code and then run commands very similar to the script which I was manually running previously. Then, using a secure string, Travis will use a GitHub token associated with my account and push the built content to GitHub. This is then pulled automatically onto using the aforementioned cron job.

Dylan Taylor
Software Engineer