Build, Update History and Release workflow (meodai/color-names)
The Build, Update History and Release workflow from meodai/color-names, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Build, Update History and Release workflow from the meodai/color-names 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, Update History and Release
on:
push:
branches: [main]
# Allow manual triggering
workflow_dispatch:
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
jobs:
build-history-release:
name: Build, Update History and Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.14.0
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Use npm 11.6.0
run: |
corepack enable
corepack prepare npm@11.6.0 --activate
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm test
- name: Generate history file
run: npm run history
- name: Check for changes
id: git-check
run: |
git add README.md changes.svg
git diff --staged --quiet || echo "changes=true" >> $GITHUB_OUTPUT
- name: Commit changes if needed
if: steps.git-check.outputs.changes == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action"
git commit --no-verify -m "docs: update README.md and changes.svg [skip ci]"
git pull --rebase https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git main
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Build, Update History and Release on: push: branches: [main] # Allow manual triggering workflow_dispatch: permissions: contents: write issues: write pull-requests: write id-token: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build-history-release: timeout-minutes: 30 name: Build, Update History and Release runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 22.14.0 cache: 'npm' registry-url: 'https://registry.npmjs.org' - name: Use npm 11.6.0 run: | corepack enable corepack prepare npm@11.6.0 --activate - name: Install dependencies run: npm ci - name: Build run: npm run build - name: Test run: npm test - name: Generate history file run: npm run history - name: Check for changes id: git-check run: | git add README.md changes.svg git diff --staged --quiet || echo "changes=true" >> $GITHUB_OUTPUT - name: Commit changes if needed if: steps.git-check.outputs.changes == 'true' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "GitHub Action" git commit --no-verify -m "docs: update README.md and changes.svg [skip ci]" git pull --rebase https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git main git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx semantic-release
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. - Cancel superseded runs when a branch or PR gets a newer push.
- 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
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.