# /var/log/journal

Thoughts, stories and ideas.

# Auto deploying my website using Travis CI

16th April 2019 · 7 minutes ·

Since I set up this blog, I wanted two things: owning my data and remove any unnecessary manual operation. Using Jekyll, I already achieved the former. Let’s achieve the latter in 50 lines of code.

While figuring things out, I decided to document my solution, so that others could do the same, without the burden part.

# Continuous Deployment

Continuous Deployment is the practice of deploying small changes frequently — rather than deploying a big change at the end of a development cycle. For example, GitHub deploys into production about 80 times a day.

The goal is to build healthier software by developing and testing in smaller increments. The same apply to content delivering.

## Say hi to Travis

Travis CI is a free Continuous Integration service for building, testing and deploying your GitHub projects. The service is free for open source repositories.

Travis allows us to have reproducible and clean builds, notifications, conditionals and a lot more. This is exactly what I want.

# Workflow

Our workflow will be simple, a single job with several phases.

1. Configuring the job
2. Installing the dependencies
3. Building the site
4. Deploying

## Configure

To tell Travis CI what to do, we have to declare a .travis.yml file. Begin to fill it with the following content.

This is quite self-explanatory. We want to use macOS, our project is Ruby based and we wish to have email notifications. That our environment.

The first phase also takes place, before installing our dependencies, we make our Gems up-to-date.

## Install

Next up, we install the dependencies.

## Build

In this phase, we build our website.

First, we declare a new type of environment variable. This one is located inside the .travis.yml file, because there is no sensitive information. JEKYLL_ENV is a Jekyll variable, JEKYLL_CONF and LOCAL_FOLDER are ones of mine.

Coming next, the generation of the blog.

# Wrapping up

or here for an up-to-date version.

You can now deploy automatically by pushing new content on the master branch, multiple times a day, and, avoiding any misfortune from using your own machine.

Isn’t that marvelous?

Last updated on 01st October 2019