Skip to content
Latchkey

Publish workflow (tighten/ziggy)

The Publish workflow from tighten/ziggy, explained and optimized by Latchkey.

C

CI health: C - fair

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

Grade your own workflow free or run it on Latchkey →
Source: tighten/ziggy.github/workflows/release.ymlLicense MITView source

What it does

This is the Publish workflow from the tighten/ziggy 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

workflow (.yml)
name: Publish
on:
  release:
    types: [published]
  workflow_dispatch:
    inputs:
      version:
        required: true
jobs:
  publish:
    name: Publish
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v4
      # Set up .npmrc file to publish to npm
      - uses: actions/setup-node@v4
        with:
          node-version: 24
          registry-url: https://registry.npmjs.org
      - run: npm ci
      # Get the 'version' field out of the package.json file
      - name: Get package.json version
        id: package-json-version
        run: echo "version=$(cat package.json | jq '.version' --raw-output)" >> $GITHUB_OUTPUT
      # Abort if the version in the package.json file (prefixed with 'v') doesn't match the tag name of the release
      - name: Check package.json version against tag name
        if: (github.event_name == 'release' && format('v{0}', steps.package-json-version.outputs.version) != github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && format('v{0}', steps.package-json-version.outputs.version) != inputs.version)
        uses: actions/github-script@v7
        with:
          script: core.setFailed('Release tag does not match package.json version!')
      # Abort if this is a pre-release and the version in the package.json file doesn't contain a '-' to indicate that (e.g. v2.0.0-beta.1), or vice-versa
      - name: Check package.json version against pre-release
        if: github.event_name == 'release' && contains(steps.package-json-version.outputs.version, '-') != github.event.release.prerelease
        uses: actions/github-script@v7
        with:
          script: core.setFailed('Stability of release tag does not match package.json version!')
      # If this is a pre-release, publish it to NPM under the 'next' tag (default is 'latest')
      - run: npm publish ${{ github.event.release.prerelease && '--tag next' || '' }}

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.

name: Publish
on:
  release:
    types: [published]
  workflow_dispatch:
    inputs:
      version:
        required: true
jobs:
  publish:
    timeout-minutes: 30
    name: Publish
    runs-on: latchkey-small
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v4
      # Set up .npmrc file to publish to npm
      - uses: actions/setup-node@v4
        with:
          cache: 'npm'
          node-version: 24
          registry-url: https://registry.npmjs.org
      - run: npm ci
      # Get the 'version' field out of the package.json file
      - name: Get package.json version
        id: package-json-version
        run: echo "version=$(cat package.json | jq '.version' --raw-output)" >> $GITHUB_OUTPUT
      # Abort if the version in the package.json file (prefixed with 'v') doesn't match the tag name of the release
      - name: Check package.json version against tag name
        if: (github.event_name == 'release' && format('v{0}', steps.package-json-version.outputs.version) != github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && format('v{0}', steps.package-json-version.outputs.version) != inputs.version)
        uses: actions/github-script@v7
        with:
          script: core.setFailed('Release tag does not match package.json version!')
      # Abort if this is a pre-release and the version in the package.json file doesn't contain a '-' to indicate that (e.g. v2.0.0-beta.1), or vice-versa
      - name: Check package.json version against pre-release
        if: github.event_name == 'release' && contains(steps.package-json-version.outputs.version, '-') != github.event.release.prerelease
        uses: actions/github-script@v7
        with:
          script: core.setFailed('Stability of release tag does not match package.json version!')
      # If this is a pre-release, publish it to NPM under the 'next' tag (default is 'latest')
      - run: npm publish ${{ github.event.release.prerelease && '--tag next' || '' }}
 

What changed

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:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow