Continuous Deployment of a Jekyll Site with Travis CI and Aerobatic
With the new Aerobatic CLI, it's now possible to host any static site using any CI tool, and the repo need not be hosted with Bitbucket. In this example, we'll set up continuous deployment of a Jekyll site whose repository is hosted on GitHub, using Travis CI.
From the Jekyll Themes site, pick a theme and fork it in GitHub.
Then, clone that repository onto your local disk.
- Go to your profile on travis-ci.org: https://travis-ci.org/profile/username
- Find the repository for which you’re interested in enabling builds.
- Click the slider on the right so it flips from a grey "X" to a green "✓".
In the root of your repository, create a new file called
language: ruby env: global: - secure: AEROBATIC_API_KEY - TRAVIS_NODE_VERSION="6.9.5" install: - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION - npm install aerobatic-cli -g - bundle install --path vendor/bundle script: - echo "url: https://!!baseurl!!" >> _config.yml - bundle exec jekyll build after_success: - aero deploy -d _site
We now need to associate the repo with Aerobatic by creating the site. Assuming you have already installed the Aerobatic CLI:
cd my-jekyll-site aero create
An environment variable named
AEROBATIC_API_KEY needs to be set in the build script in order to make authenticated calls to the Aerobatic API. Each CD service has a mechanism for setting environment variables. It’s recommended that the value be encrypted if your service supports it. Travis provides a command line tool for encrypting a variable and injecting it into the
aero apikey gem install travis travis encrypt AEROBATIC_API_KEY=<super_secret> --add env.matrix
To get your
AEROBATIC_API_KEY to insert into the placeholder
<super_secret>, you can run the
aero apikey command.
At this point, you're ready to commit your code and let Travis build the Jekyll site for you
git add --all git commit -m "Set up Travis build" git push origin master
As a reminder, if you run
aero info, you'll get your production URL. You can also rename the site if you so wish with the
aero rename command.