release workflow (pmndrs/drei)
The release workflow from pmndrs/drei, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the release workflow from the pmndrs/drei 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: release
on:
push:
branches:
- 'master'
- 'beta'
- 'alpha'
- 'canary-*'
- 'rc'
pull_request: {}
permissions:
contents: write
id-token: write
# Cancel any previous run (see: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
container:
image: ghcr.io/pmndrs/playwright:drei
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 0.159.0 is mandatory; others are informational
strategy:
fail-fast: false
matrix:
three-version: ['0.159.0', '0.180.0', 'latest']
continue-on-error: ${{ matrix.three-version != '0.159.0' }}
name: test (w/ three@${{ matrix['three-version'] }})
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: 'yarn'
- run: yarn install
- run: yarn build
- run: yarn eslint:ci
- run: yarn typecheck
- run: yarn prettier
- run: (cd test/e2e; ./e2e.sh ${{ matrix.three-version }})
- name: Upload Playwright screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-screenshots-${{ matrix.three-version }}
path: |
test-results/**
if-no-files-found: ignore
retention-days: 7
build-and-release:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install
- run: yarn build
- run: yarn build-storybook
# semantic-release skips not configured branches(see: release.config.js) or pull-requests
- run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: release on: push: branches: - 'master' - 'beta' - 'alpha' - 'canary-*' - 'rc' pull_request: {} permissions: contents: write id-token: write # Cancel any previous run (see: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency) concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test: timeout-minutes: 30 runs-on: latchkey-small container: image: ghcr.io/pmndrs/playwright:drei credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # 0.159.0 is mandatory; others are informational strategy: fail-fast: false matrix: three-version: ['0.159.0', '0.180.0', 'latest'] continue-on-error: ${{ matrix.three-version != '0.159.0' }} name: test (w/ three@${{ matrix['three-version'] }}) steps: - uses: actions/checkout@v4 - run: corepack enable - uses: actions/setup-node@v4 with: cache: 'yarn' - run: yarn install - run: yarn build - run: yarn eslint:ci - run: yarn typecheck - run: yarn prettier - run: (cd test/e2e; ./e2e.sh ${{ matrix.three-version }}) - name: Upload Playwright screenshots if: always() uses: actions/upload-artifact@v4 with: name: playwright-screenshots-${{ matrix.three-version }} path: | test-results/** if-no-files-found: ignore retention-days: 7 build-and-release: timeout-minutes: 30 needs: test runs-on: latchkey-small steps: - uses: actions/checkout@v4 - run: corepack enable - uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' - run: yarn install - run: yarn build - run: yarn build-storybook # semantic-release skips not configured branches(see: release.config.js) or pull-requests - run: yarn release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
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
- End-to-end and browser tests
This workflow runs 2 jobs (4 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.