Skip to content

Commit f3768d3

Browse files
authored
Refactor Jekyll workflow for Ruby setup
Updated Ruby setup and removed preinstallation workaround.
1 parent a0d8632 commit f3768d3

File tree

1 file changed

+19
-37
lines changed

1 file changed

+19
-37
lines changed

.github/workflows/jekyll.yml

Lines changed: 19 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,57 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
16
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
27
name: Deploy Jekyll site to Pages
38

49
on:
10+
# Runs on pushes targeting the default branch
511
push:
612
branches: ["main"]
13+
14+
# Allows you to run this workflow manually from the Actions tab
715
workflow_dispatch:
816

17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
918
permissions:
1019
contents: read
1120
pages: write
1221
id-token: write
1322

23+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
24+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1425
concurrency:
1526
group: "pages"
1627
cancel-in-progress: false
1728

1829
jobs:
30+
# Build job
1931
build:
2032
runs-on: ubuntu-latest
2133
steps:
2234
- name: Checkout
2335
uses: actions/checkout@v4
24-
25-
# --- Begin ubuntu-24.04 workaround: preinstall Ruby into toolcache ---
26-
- name: Preinstall Ruby into toolcache (ubuntu-24.04 workaround)
27-
if: startsWith(runner.os, 'Linux')
28-
shell: bash
29-
run: |
30-
set -euxo pipefail
31-
VER=3.1.4
32-
DEST=/opt/hostedtoolcache/Ruby/$VER/x64
33-
34-
if [ -f "$DEST.complete" ]; then
35-
echo "Ruby $VER already installed in toolcache."
36-
exit 0
37-
fi
38-
39-
sudo apt-get update
40-
sudo apt-get install -y --no-install-recommends \
41-
build-essential libssl-dev zlib1g-dev libreadline-dev libyaml-dev \
42-
libgdbm-dev libncurses5-dev libffi-dev libdb-dev uuid-dev ca-certificates git
43-
44-
git clone --depth=1 https://github.com/rbenv/ruby-build.git /tmp/ruby-build
45-
sudo mkdir -p "$DEST"
46-
sudo /tmp/ruby-build/bin/ruby-build "$VER" "$DEST"
47-
48-
sudo chmod -R a+rX /opt/hostedtoolcache/Ruby
49-
sudo touch "$DEST.complete"
50-
51-
"$DEST/bin/ruby" -v
52-
# --- End workaround ---
53-
5436
- name: Setup Ruby
55-
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
37+
uses: ruby/setup-ruby@086ffb1a2090c870a3f881cc91ea83aa4243d408 # v1.195.0
5638
with:
57-
ruby-version: '3.1.4' # ensure it matches the preinstalled version
58-
bundler-cache: true
59-
cache-version: 0
60-
39+
ruby-version: '3.1' # Not needed with a .ruby-version file
40+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
41+
cache-version: 0 # Increment this number if you need to re-download cached gems
6142
- name: Setup Pages
6243
id: pages
6344
uses: actions/configure-pages@v5
64-
6545
- name: Build with Jekyll
46+
# Outputs to the './_site' directory by default
6647
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
6748
env:
6849
JEKYLL_ENV: production
69-
7050
- name: Upload artifact
51+
# Automatically uploads an artifact from the './_site' directory by default
7152
uses: actions/upload-pages-artifact@v3
7253

54+
# Deployment job
7355
deploy:
7456
environment:
7557
name: github-pages

0 commit comments

Comments
 (0)