Building, testing, and deploying your Jekyll-generated website can quickly be done with CircleCI, a continuous integration & delivery tool. CircleCI supports GitHub and Bitbucket, and you can get started for free using an open-source or private repository.
To start building your project on CircleCI, all you need to do is ‘follow’ your project from CircleCI’s website:
The easiest way to manage dependencies for a Jekyll project (with or without CircleCI) is via a Gemfile. You’d want to have Jekyll, any Jekyll plugins, HTML Proofer, and any other gems that you are using in the
Gemfile. Don’t forget to version
Gemfile.lock as well. Here’s an example
source 'https://rubygems.org' ruby '2.4.0' gem 'jekyll' gem 'html-proofer'
CircleCI detects when
Gemfile is present is will automatically run
bundle install for you in the
The most basic test that can be run is simply seeing if
jekyll build actually works. This is a blocker, a dependency if you will, for other tests you might run on the generate site. So we’ll run Jekyll, via Bundler, in the
dependencies: post: - bundle exec jekyll build
With your site built, it’s useful to run tests to check for valid HTML, broken links, etc. There’s a few tools out there but HTML Proofer is popular amongst Jekyll users. We’ll run it in the
test phase with a few preferred flags. Check out the
html-proofer README for all available flags, or run
htmlproofer --help locally.
test: post: - bundle exec htmlproofer ./_site --check-html --disable-external
When you put it all together, here’s an example of what that
circle.yml file could look like:
machine: environment: NOKOGIRI_USE_SYSTEM_LIBRARIES: true # speeds up installation of html-proofer dependencies: post: - bundle exec jekyll build test: post: - bundle exec htmlproofer ./_site --allow-hash-href --check-favicon --check-html --disable-external deployment: prod: branch: master commands: - rsync -va --delete ./_site username@my-website:/var/html
© 2008–2018 Tom Preston-Werner and Jekyll contributors
Licensed under the MIT license.