Jekyll and GitHub Actions
One of the problems with github pages is that it relies on an old version of Jekyll (3.9.0) I’m looking to understand what’s needed to remove this limitation.
Starting with a new site as the template.
Presumes you have Ruby / chruby setup.
- Create a new github repository
https://github.com/new
- Clone that repository
I use GitKraken, but feel free to use GitHub Desktop.
- Confirm ruby version we want
A good reference for the current release is: https://endoflife.date/ruby
Choose a version from here. Today this is 3.2.2 https://rubychangelog.com/versions-all/#ruby-322
$ chruby 3.2.2
$ chruby
ruby-3.0.6
ruby-3.1.4
* ruby-3.2.2
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
- Create a new Jekyll project
% gem install bundler jekyll
Successfully installed bundler-2.4.22
Successfully installed jekyll-4.3.2
2 gems installed
% jekyll new .
Running bundle install in /Users/tom/playground/cobalt...
Bundler: Fetching gem metadata from https://rubygems.org/............
Bundler: Resolving dependencies...
Bundler: Bundle complete! 7 Gemfile dependencies, 33 gems now installed.
Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.
New jekyll site installed in /Users/tom/playground/cobalt.
- Ruby version file To avoid needing to run chruby (manually select) Ruby when opening the project, we’ll create a “.ruby-version” file. https://github.com/postmodern/chruby#auto-switching
% echo 3.2.2 >> .ruby-version
To test it’s working as expected
% cd ~
% cd -
% ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
- Gemfile.lock PLATFORMS…?
bundle lock --add-platform ruby
- Create starter script from GitHub Actions
https://github.com/[profile]/[repo]/actions/new so in my case: https://github.com/rakuna/cobalt/actions/new
Then search for Jekyll.
Commit the jekyll.yml to the repo.
https://github.com/rakuna/cobalt/new/main?filename=.github%2Fworkflows%2Fblank.yml&workflow_template=ci%2Fblank
https://github.com/rakuna/cobalt/new/main?filename=.github%2Fworkflows%2Fjekyll.yml&workflow_template=pages%2Fjekyll
- Configure repo to run github pages
https://github.com/rakuna/cobalt/settings/pages
- Update Gemfile.lock
bundle lock –add-platform x86_64-darwin-20