This is an AMP version of the article, its original content can be found here.
Deploy Jekyll to GitHub Pages
This blog is written in Jekyll and is hosted at GitHub Pages. It uses half a dozen custom plugins, which are not allowed there.
Here is how I deploy it:
That's it. jgd is my Ruby gem (stands for "Jekyll GitHub Deploy"), which does the trick. Here is what it does:
It clones your existing repository from the current directory to a temporary one (guessing the URL of the repo from
jekyll buildin that temporary directory, which saves the output in another temporary directory.
gh-pagesbranch or creates one if it doesn't exist.
Copies the content of the site built by
jekyll buildinto the branch, thus overwriting existing files, commits and pushes to GitHub.
Cleans up all temporary directories.
Using this gem is very easy. Just install it with
gem install jgd and then run in the root directory of your Jekyll blog.
What is important is that your Jekyll site files be located in the root directory of the repository. Just as they do on this blog; see its sources in GitHub.
You can easily integrate
jgd with Travis. See
.travis.yml of this blog.
Full documentation about the gem is located here.