Skip to content

Commit 56a0bce

Browse files
committed
Test Workflow
Separate out our build step into a reusable GitHub Action, and call it from our test workflow and from our deploy workflow.
1 parent 51ee87d commit 56a0bce

3 files changed

Lines changed: 40 additions & 11 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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@v1
8+
with:
9+
path: vendor/bundle
10+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
11+
12+
- name: Install Ruby Gems
13+
shell: bash
14+
run: |
15+
gem install bundler
16+
bundle install --path vendor/bundle
17+
18+
- name: Jekyll Build
19+
shell: bash
20+
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)