When building a Jekyll site with GitHub Pages, Jekyll runs in an environment restricted for security reasons, yet containing numerous whitelisted plugins and themes to make it simpler to get a site set up.
The only workaround to have control over the build environment and gemset yet use GitHub Pages to host the site was previously by building elsewhere and pushing the built directory contents to the gh-pages branch on your repository.
However, GitHub now provides you with the option to use their in-house CI/CD product named GitHub Actions to build and deploy (host) your Jekyll site with complete control over the build environment and gemset.
4.4.1, or point directly to the repository via the Gemfile.*.rb files placed in the _plugins directory of your site.If you are migrating from the classic flow but want to keep using a GitHub-hosted theme, you may use the jekyll-remote-theme plugin, add any required dependencies of your theme (previously bundled by default) into your_config.ymlandGemfileand set theremote_theme: <owner>/<repo_name>theme repository slug correctly in your_config.yml.
ruby/setup-ruby action makes it possible to cache installed gems automatically instead of having to download the bundle on each build.The first and foremost requirement is a Jekyll project hosted at GitHub. Choose an existing Jekyll project or follow the quickstart and push the repository to GitHub if it is not hosted there already.
The Jekyll site we’ll be using for the rest of this page, initially consists of just a _config.yml, an index.md page and a Gemfile. The contents are respectively:
# _config.yml title: "Jekyll Actions Demo"
---
---
Welcome to My Home Page
{% assign date = '2020-04-13T10:20:00Z' %}
- Original date - {{ date }}
- With timeago filter - {{ date | timeago }}
# Gemfile source 'https://rubygems.org' gem "jekyll", "~> 4.2" group :jekyll_plugins do gem "jekyll-timeago", "~> 0.13.1" end
The demo site uses Jekyll 4 and a third-party plugin, both of which are currently not whitelisted for use on GitHub pages. The plugin will allow us to describe how far back a date was from today. e.g. If we give a date as2016-03-23T10:20:00Zand the current date is2020-04-13T10:20:00Z, then the output would be4 years and 3 weeks ago.
The action we’re using takes care of installing the Ruby gems and dependencies. While that keeps the setup simple for the user, one may encounter issues if they also check-in Gemfile.lock if it was generated with an old version of Bundler. On pushing any local changes onto the default branch, the action will be triggered and the build will start.
To watch the progress and see any build errors, check on the build status using one of the following approaches:
jekyll workflow tab.If all goes well, all steps will be green and the built assets will be uploaded to GitHub Pages.
To see the live site, go to the Deployments tab on your repository, and click on the deployed site URL.
When you need to make further changes to the site, commit to the default branch and push. The workflow will build and deploy your site again.
© 2025 Jekyll Core Team and contributors
Licensed under the MIT license.
https://jekyllrb.com/docs/continuous-integration/github-actions/