Skip to content

Commit 4cd5c74

Browse files
committed
fixes?
1 parent 7544a98 commit 4cd5c74

File tree

2 files changed

+149
-22
lines changed

2 files changed

+149
-22
lines changed

.github/workflows/jekyll.yml

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,125 @@
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-
6-
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
71
name: Deploy Jekyll site to Pages
82

93
on:
10-
# Runs on pushes targeting the default branch
114
push:
125
branches: ["master"]
13-
14-
# Allows you to run this workflow manually from the Actions tab
156
workflow_dispatch:
167

17-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
188
permissions:
199
contents: read
2010
pages: write
2111
id-token: write
2212

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.
2513
concurrency:
2614
group: "pages"
2715
cancel-in-progress: false
2816

17+
env:
18+
RUBY_VERSION_FULL: "3.1.4" # exact version we’ll place in toolcache
19+
RUBY_VERSION_SHORT: "3.1" # what bundler/setup-ruby will request
20+
TOOLCACHE_DIR: "${{ env.RUNNER_TOOL_CACHE || '/opt/hostedtoolcache' }}"
21+
2922
jobs:
30-
# Build job
3123
build:
32-
runs-on: ubuntu-latest
24+
# If you truly must run on your Ubuntu 24.04 self-hosted label, keep it.
25+
# For GitHub-hosted 24.04, use: runs-on: ubuntu-24.04
26+
runs-on: ubuntu-24.04
3327
steps:
3428
- name: Checkout
3529
uses: actions/checkout@v4
30+
31+
# --- Bootstrap Ruby into toolcache if needed (self-hosted-detected case) ---
32+
- name: Ensure Ruby in toolcache (self-hosted safe)
33+
shell: bash
34+
run: |
35+
set -euo pipefail
36+
RUBY_DIR="$TOOLCACHE_DIR/Ruby/$RUBY_VERSION_FULL/x64"
37+
SENTINEL="$RUBY_DIR.complete"
38+
LOCK="/var/tmp/ruby-${RUBY_VERSION_FULL}.lock"
39+
echo "Toolcache dir: $TOOLCACHE_DIR"
40+
echo "Target Ruby dir: $RUBY_DIR"
41+
42+
if [ -f "$SENTINEL" ]; then
43+
echo "Ruby $RUBY_VERSION_FULL already present (sentinel found)."
44+
exit 0
45+
fi
46+
47+
# If the runner already has a working Ruby matching the short version, don't rebuild.
48+
if command -v ruby >/dev/null 2>&1; then
49+
INSTALLED="$(ruby -e 'print RUBY_VERSION' || true)"
50+
if [[ "${INSTALLED:-}" == ${RUBY_VERSION_SHORT}.* ]]; then
51+
echo "A matching Ruby ${INSTALLED} is already available on PATH; skipping toolcache build."
52+
# Let setup-ruby use this one.
53+
exit 0
54+
fi
55+
fi
56+
57+
sudo mkdir -p "$RUBY_DIR"
58+
sudo chown -R "$USER":"$USER" "$TOOLCACHE_DIR"
59+
60+
# Serialize builds across parallel jobs
61+
exec 9>"$LOCK"
62+
if ! flock -n 9; then
63+
echo "Another job is building Ruby. Waiting on lock..."
64+
flock 9
65+
fi
66+
67+
# Double-check after acquiring lock.
68+
if [ -f "$SENTINEL" ]; then
69+
echo "Ruby $RUBY_VERSION_FULL now present (sentinel found after lock)."
70+
exit 0
71+
fi
72+
73+
echo "Installing build prerequisites..."
74+
sudo apt-get update -y
75+
sudo apt-get install -y \
76+
build-essential autoconf bison \
77+
libssl-dev zlib1g-dev libreadline-dev libyaml-dev \
78+
libxml2-dev libxslt1-dev libffi-dev libgdbm-dev \
79+
libdb-dev uuid-dev
80+
81+
echo "Installing ruby-build..."
82+
if ! command -v ruby-build >/dev/null 2>&1; then
83+
git clone --depth=1 https://github.com/rbenv/ruby-build.git
84+
sudo ./ruby-build/install.sh
85+
fi
86+
87+
echo "Building Ruby $RUBY_VERSION_FULL into toolcache..."
88+
ruby-build "$RUBY_VERSION_FULL" "$RUBY_DIR"
89+
90+
# Setup toolcache layout for setup-ruby
91+
# (create a version file; some tools look for this)
92+
echo "$RUBY_VERSION_FULL" > "$RUBY_DIR.version"
93+
94+
# Mark complete so other jobs don't rebuild
95+
touch "$SENTINEL"
96+
97+
echo "Ruby $RUBY_VERSION_FULL installed at $RUBY_DIR"
98+
3699
- name: Setup Ruby
37-
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
100+
uses: ruby/setup-ruby@v1
38101
with:
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
102+
ruby-version: ${{ env.RUBY_VERSION_SHORT }} # '3.1'
103+
bundler-cache: true
104+
cache-version: 0
105+
42106
- name: Setup Pages
43107
id: pages
44108
uses: actions/configure-pages@v4
109+
45110
- name: Build with Jekyll
46-
# Outputs to the './_site' directory by default
47111
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
48112
env:
49113
JEKYLL_ENV: production
114+
50115
- name: Upload artifact
51-
# Automatically uploads an artifact from the './_site' directory by default
52116
uses: actions/upload-pages-artifact@v3
53117

54-
# Deployment job
55118
deploy:
56119
environment:
57120
name: github-pages
58121
url: ${{ steps.deployment.outputs.page_url }}
59-
runs-on: ubuntu-latest
122+
runs-on: ubuntu-24.04
60123
needs: build
61124
steps:
62125
- name: Deploy to GitHub Pages

.github/workflows/jekyll_old.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
6+
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
7+
name: Deploy Jekyll site to Pages
8+
9+
on:
10+
# Runs on pushes targeting the default branch
11+
push:
12+
branches: ["master"]
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
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.
25+
concurrency:
26+
group: "pages"
27+
cancel-in-progress: false
28+
29+
jobs:
30+
# Build job
31+
build:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
- name: Setup Ruby
37+
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
38+
with:
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
42+
- name: Setup Pages
43+
id: pages
44+
uses: actions/configure-pages@v4
45+
- name: Build with Jekyll
46+
# Outputs to the './_site' directory by default
47+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
48+
env:
49+
JEKYLL_ENV: production
50+
- name: Upload artifact
51+
# Automatically uploads an artifact from the './_site' directory by default
52+
uses: actions/upload-pages-artifact@v3
53+
54+
# Deployment job
55+
deploy:
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
runs-on: ubuntu-latest
60+
needs: build
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)