Build Gem Artifact workflow (jekyll/jekyll-admin)
The Build Gem Artifact workflow from jekyll/jekyll-admin, explained and optimized by Latchkey.
CI health: B - good
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the Build Gem Artifact workflow from the jekyll/jekyll-admin repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Build Gem Artifact
on:
workflow_dispatch:
jobs:
build_gem:
name: Build Gem Artifact
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: "Set up Ruby 2.7"
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true
- name: "Set up Node 12"
uses: actions/setup-node@v2
with:
node-version: "12"
cache: yarn
- name: Install Frontend Dependencies
run: yarn install
- name: Test Backend
run: bundle exec rspec
- name: Test and Build Frontend
run: bash script/build
- name: Build Gem
run: gem build jekyll-admin.gemspec
- name: Stash Gem as Temporary Artifact
uses: actions/upload-artifact@v4
with:
name: "jekyll-admin.gem"
path: "${{ github.workspace }}/*.gem"
retention-days: 15
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Build Gem Artifact on: workflow_dispatch: jobs: build_gem: timeout-minutes: 30 name: Build Gem Artifact runs-on: "ubuntu-latest" strategy: fail-fast: true steps: - name: Checkout Repository uses: actions/checkout@v4 - name: "Set up Ruby 2.7" uses: ruby/setup-ruby@v1 with: ruby-version: "2.7" bundler-cache: true - name: "Set up Node 12" uses: actions/setup-node@v2 with: node-version: "12" cache: yarn - name: Install Frontend Dependencies run: yarn install - name: Test Backend run: bundle exec rspec - name: Test and Build Frontend run: bash script/build - name: Build Gem run: gem build jekyll-admin.gemspec - name: Stash Gem as Temporary Artifact uses: actions/upload-artifact@v4 with: name: "jekyll-admin.gem" path: "${{ github.workspace }}/*.gem" retention-days: 15
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.