Skip to content
Latchkey

npm publish workflow (cytoscape/cytoscape.js)

The npm publish workflow from cytoscape/cytoscape.js, explained and optimized by Latchkey.

A

CI health: A - excellent

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

Grade your own workflow free or run it on Latchkey →
Source: cytoscape/cytoscape.js.github/workflows/npm-publish.ymlLicense MITView source

What it does

This is the npm publish workflow from the cytoscape/cytoscape.js 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: npm publish

permissions:
  contents: read # Required for OIDC
  id-token: write # Required for OIDC

on:
  workflow_call:
  workflow_dispatch:

jobs:
  publish:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    environment: prod

    steps:
      - uses: actions/checkout@v6
        with:
          ref: master
      - uses: actions/setup-node@v6
        with:
          node-version-file: .nvmrc
          package-manager-cache: false # never use caching in release builds
          registry-url: 'https://registry.npmjs.org' 
      - name: Publish Package To npmjs
        run: npm publish

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: npm publish
 
permissions:
  contents: read # Required for OIDC
  id-token: write # Required for OIDC
 
on:
  workflow_call:
  workflow_dispatch:
 
jobs:
  publish:
    runs-on: latchkey-small
    timeout-minutes: 5
    environment: prod
 
    steps:
      - uses: actions/checkout@v6
        with:
          ref: master
      - uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version-file: .nvmrc
          package-manager-cache: false # never use caching in release builds
          registry-url: 'https://registry.npmjs.org' 
      - name: Publish Package To npmjs
        run: npm publish
 

What changed

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