The Relicans

loading...
Cover image for Deploying Jekyll with GitHub Actions, not Pages

Deploying Jekyll with GitHub Actions, not Pages

ChaelCodes
Rachael streams programming games and open-source on Twitch. She's been a professional dev since 2012, 3x Team Lead, and currently, she works as a Developer Relations Engineer for New Relic.
Updated on ・2 min read

I built a Gem that embeds Twitch clips in Jekyll Sites! Unfortunately, I can't use it, because I'm deploying using github-pages. So let's change the deploy process. 😏

This is the technical plan and research for a stream on 3/26 at 15:00 UTC. Catch it live.

Why do we have to do this?

GitHub pages is where my site is hosted. They require you to add the gh-pages gem instead of the jekyll gem, and they lock the version of Jekyll at 3.9.0. They would have to rework how gh-pages interacts with GitHub servers to support Jekyll 4.0, and that would break all the 3.9 sites out there. They've decided not to upgrade instead.

They also don't let you add random plugins. Only their allow list, and my baby Jekyll-Twitch isn't on it.

Full conversation here:

Support for Jekyll 4.0 #651

janko avatar
janko posted on

Jekyll 4.0.0 is out, and brings lots of nice improvements. It would be really nice if github-pages gem would add support for Jekyll 4.

So, what's the plan?

Jekyll has shared a guide on deploying using GitHub Actions. We'll need a github_pages.yml file in .github/workflows. This is going to trigger every time we push to main. It'll call out to a jekyll-action created by helaili which deploys the static site on the gh-pages branch. The jekyll-action deprecates JEKYLL_PAT, so we should update their docs while we do this.

There's some additional GitHub configuration necessary. First, the jekyll action needs a github token to push to the gh-pages branch, then GitHub needs to use the gh-pages branch instead of the main branch.

We'll need to include a secret in our action to store the github token.

This was easier than I thought.

Deploy Site via GitHub Actions #11

Description

closes #9 GitHub pages builds do not support Jekyll 4, nor custom gems. For this reason, we are deploying our Jekyll site to GitHub Pages using a custom GitHub Action.

The research is all here in my blog.

Discussion (0)