Skip to content
Latchkey

CI - Release workflow (npm/node-semver)

The CI - Release workflow from npm/node-semver, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: npm/node-semver.github/workflows/ci-release.ymlLicense ISCView source

What it does

This is the CI - Release workflow from the npm/node-semver repository, a real project running GitHub Actions. It is shown here with attribution under its ISC license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# This file is automatically added by @npmcli/template-oss. Do not edit.

name: CI - Release

on:
  workflow_dispatch:
    inputs:
      ref:
        required: true
        type: string
        default: main
  workflow_call:
    inputs:
      ref:
        required: true
        type: string
      check-sha:
        required: true
        type: string

permissions:
  contents: read
  checks: write

jobs:
  lint-all:
    name: Lint All
    if: github.repository_owner == 'npm'
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          ref: ${{ inputs.ref }}
      - name: Setup Git User
        run: |
          git config --global user.email "npm-cli+bot@github.com"
          git config --global user.name "npm CLI robot"
      - name: Create Check
        id: create-check
        if: ${{ inputs.check-sha }}
        uses: ./.github/actions/create-check
        with:
          name: "Lint All"
          token: ${{ secrets.GITHUB_TOKEN }}
          sha: ${{ inputs.check-sha }}
      - name: Setup Node
        uses: actions/setup-node@v6
        id: node
        with:
          node-version: 26.x
          check-latest: contains('26.x', '.x')
      - name: Install Latest npm
        uses: ./.github/actions/install-latest-npm
        with:
          node: ${{ steps.node.outputs.node-version }}
      - name: Install Dependencies
        run: npm i --ignore-scripts --no-audit --no-fund
      - name: Lint
        run: npm run lint --ignore-scripts
      - name: Post Lint
        run: npm run postlint --ignore-scripts
      - name: Conclude Check
        uses: LouisBrunner/checks-action@v1.6.0
        if: steps.create-check.outputs.check-id && always()
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          conclusion: ${{ job.status }}
          check_id: ${{ steps.create-check.outputs.check-id }}

  test-all:
    name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
    if: github.repository_owner == 'npm'
    strategy:
      fail-fast: false
      matrix:
        platform:
          - name: Linux
            os: ubuntu-latest
            shell: bash
          - name: macOS
            os: macos-latest
            shell: bash
          - name: macOS
            os: macos-15-intel
            shell: bash
          - name: Windows
            os: windows-latest
            shell: cmd
        node-version:
          - 10.0.0
          - 10.x
          - 12.x
          - 14.x
          - 16.x
          - 18.x
          - 20.x
          - 22.x
          - 24.x
          - 26.x
        exclude:
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 10.0.0
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 10.x
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 12.x
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 14.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 16.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 18.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 20.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 22.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 24.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 26.x
    runs-on: ${{ matrix.platform.os }}
    defaults:
      run:
        shell: ${{ matrix.platform.shell }}
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          ref: ${{ inputs.ref }}
      - name: Setup Git User
        run: |
          git config --global user.email "npm-cli+bot@github.com"
          git config --global user.name "npm CLI robot"
      - name: Create Check
        id: create-check
        if: ${{ inputs.check-sha }}
        uses: ./.github/actions/create-check
        with:
          name: "Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
          token: ${{ secrets.GITHUB_TOKEN }}
          sha: ${{ inputs.check-sha }}
      - name: Setup Node
        uses: actions/setup-node@v6
        id: node
        with:
          node-version: ${{ matrix.node-version }}
          check-latest: contains(matrix.node-version, '.x')
      - name: Install Latest npm
        if: ${{ !startsWith(matrix.node-version, '22.') }}
        uses: ./.github/actions/install-latest-npm
        with:
          node: ${{ steps.node.outputs.node-version }}
      - name: Install Dependencies
        run: npm i --ignore-scripts --no-audit --no-fund
      - name: Add Problem Matcher
        run: echo "::add-matcher::.github/matchers/tap.json"
      - name: Test
        run: npm test --ignore-scripts
      - name: Conclude Check
        uses: LouisBrunner/checks-action@v1.6.0
        if: steps.create-check.outputs.check-id && always()
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          conclusion: ${{ job.status }}
          check_id: ${{ steps.create-check.outputs.check-id }}

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

# This file is automatically added by @npmcli/template-oss. Do not edit.
 
name: CI - Release
 
on:
  workflow_dispatch:
    inputs:
      ref:
        required: true
        type: string
        default: main
  workflow_call:
    inputs:
      ref:
        required: true
        type: string
      check-sha:
        required: true
        type: string
 
permissions:
  contents: read
  checks: write
 
jobs:
  lint-all:
    timeout-minutes: 30
    name: Lint All
    if: github.repository_owner == 'npm'
    runs-on: latchkey-small
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          ref: ${{ inputs.ref }}
      - name: Setup Git User
        run: |
          git config --global user.email "npm-cli+bot@github.com"
          git config --global user.name "npm CLI robot"
      - name: Create Check
        id: create-check
        if: ${{ inputs.check-sha }}
        uses: ./.github/actions/create-check
        with:
          name: "Lint All"
          token: ${{ secrets.GITHUB_TOKEN }}
          sha: ${{ inputs.check-sha }}
      - name: Setup Node
        uses: actions/setup-node@v6
        id: node
        with:
          cache: 'npm'
          node-version: 26.x
          check-latest: contains('26.x', '.x')
      - name: Install Latest npm
        uses: ./.github/actions/install-latest-npm
        with:
          node: ${{ steps.node.outputs.node-version }}
      - name: Install Dependencies
        run: npm i --ignore-scripts --no-audit --no-fund
      - name: Lint
        run: npm run lint --ignore-scripts
      - name: Post Lint
        run: npm run postlint --ignore-scripts
      - name: Conclude Check
        uses: LouisBrunner/checks-action@v1.6.0
        if: steps.create-check.outputs.check-id && always()
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          conclusion: ${{ job.status }}
          check_id: ${{ steps.create-check.outputs.check-id }}
 
  test-all:
    timeout-minutes: 30
    name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
    if: github.repository_owner == 'npm'
    strategy:
      fail-fast: false
      matrix:
        platform:
          - name: Linux
            os: ubuntu-latest
            shell: bash
          - name: macOS
            os: macos-latest
            shell: bash
          - name: macOS
            os: macos-15-intel
            shell: bash
          - name: Windows
            os: windows-latest
            shell: cmd
        node-version:
          - 10.0.0
          - 10.x
          - 12.x
          - 14.x
          - 16.x
          - 18.x
          - 20.x
          - 22.x
          - 24.x
          - 26.x
        exclude:
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 10.0.0
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 10.x
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 12.x
          - platform: { name: macOS, os: macos-latest, shell: bash }
            node-version: 14.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 16.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 18.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 20.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 22.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 24.x
          - platform: { name: macOS, os: macos-15-intel, shell: bash }
            node-version: 26.x
    runs-on: ${{ matrix.platform.os }}
    defaults:
      run:
        shell: ${{ matrix.platform.shell }}
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          ref: ${{ inputs.ref }}
      - name: Setup Git User
        run: |
          git config --global user.email "npm-cli+bot@github.com"
          git config --global user.name "npm CLI robot"
      - name: Create Check
        id: create-check
        if: ${{ inputs.check-sha }}
        uses: ./.github/actions/create-check
        with:
          name: "Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}"
          token: ${{ secrets.GITHUB_TOKEN }}
          sha: ${{ inputs.check-sha }}
      - name: Setup Node
        uses: actions/setup-node@v6
        id: node
        with:
          cache: 'npm'
          node-version: ${{ matrix.node-version }}
          check-latest: contains(matrix.node-version, '.x')
      - name: Install Latest npm
        if: ${{ !startsWith(matrix.node-version, '22.') }}
        uses: ./.github/actions/install-latest-npm
        with:
          node: ${{ steps.node.outputs.node-version }}
      - name: Install Dependencies
        run: npm i --ignore-scripts --no-audit --no-fund
      - name: Add Problem Matcher
        run: echo "::add-matcher::.github/matchers/tap.json"
      - name: Test
        run: npm test --ignore-scripts
      - name: Conclude Check
        uses: LouisBrunner/checks-action@v1.6.0
        if: steps.create-check.outputs.check-id && always()
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          conclusion: ${{ job.status }}
          check_id: ${{ steps.create-check.outputs.check-id }}
 

What changed

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.

This workflow runs 2 jobs (41 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow