Skip to content

Commit ff6bb66

Browse files
committed
Update actions/cache and Run Tests on PRs
Our build and deploy workflow was using an outdated version of actions/cache that's no longer supported. That can be fixed by updating to actions/cache@v4. No interface changes are required in our YAML. We also need a way to make sure this works before merging the PR (if we don't want to debug a workflow after merge). The simplest way to do this is to extract our jekyll build steps into a github action. We can write a simple test workflow that just does a jekyll build, and we can use the same jekyll-build action in our existing deploy workflow.
1 parent 51ee87d commit ff6bb66

3 files changed

Lines changed: 41 additions & 11 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Jekyll Build
2+
description: Installs Ruby gems and builds Jekyll site
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Cache Gem Dependencies
7+
uses: actions/cache@v4
8+
with:
9+
path: vendor/bundle
10+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock', '.ruby-version') }}
11+
12+
- name: Install Ruby Gems
13+
shell: bash
14+
run: |
15+
gem install bundler
16+
bundle config set path 'vendor/bundle'
17+
bundle install
18+
19+
- name: Jekyll Build
20+
shell: bash
21+
run: bundle exec jekyll build

.github/workflows/github-pages.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,8 @@ jobs:
1616
container: ruby:3.2.2-bookworm
1717
steps:
1818
- uses: actions/checkout@v2
19-
- uses: actions/cache@v1
20-
with:
21-
path: vendor/bundle
22-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
23-
24-
- name: Install Ruby dependencies.
25-
run: |
26-
gem install bundler
27-
bundle install --path vendor/bundle
2819

29-
- name: Build static site with Jekyll.
30-
run: bundle exec jekyll build
20+
- uses: ./.github/actions/jekyll-build
3121

3222
- name: Deploy static site to gh-pages branch.
3323
uses: peaceiris/actions-gh-pages@v3

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# GitHub Action for Jekyll
2+
#
3+
# Runs jekyll build on pull requests to verify that they build.
4+
5+
name: Test Build
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
container: ruby:3.2.2-bookworm
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- uses: ./.github/actions/jekyll-build

0 commit comments

Comments
 (0)