Skip to content
Latchkey

npm-publish workflow (PrismarineJS/mineflayer)

The npm-publish workflow from PrismarineJS/mineflayer, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, 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: PrismarineJS/mineflayer.github/workflows/npm-publish.ymlLicense MITView source

What it does

This is the npm-publish workflow from the PrismarineJS/mineflayer 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
on:
  push:
    branches:
      - master # Change this to your default branch
permissions:
  id-token: write
  contents: write
jobs:
  npm-publish:
    name: npm-publish
    runs-on: ubuntu-latest
    steps:
    - name: Checkout repository
      uses: actions/checkout@master
    - name: Set up Node.js
      uses: actions/setup-node@master
      with:
        node-version: 24
        registry-url: 'https://registry.npmjs.org'
    - id: publish
      uses: JS-DevTools/npm-publish@v4
    - name: Create Release
      if: ${{ steps.publish.outputs.type }}
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ steps.publish.outputs.version }}
        release_name: Release ${{ steps.publish.outputs.version }}
        body: ${{ steps.publish.outputs.version }}
        draft: false
        prerelease: false

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
on:
  push:
    branches:
      - master # Change this to your default branch
permissions:
  id-token: write
  contents: write
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  npm-publish:
    timeout-minutes: 30
    name: npm-publish
    runs-on: latchkey-small
    steps:
    - name: Checkout repository
      uses: actions/checkout@master
    - name: Set up Node.js
      uses: actions/setup-node@master
      with:
        cache: 'npm'
        node-version: 24
        registry-url: 'https://registry.npmjs.org'
    - id: publish
      uses: JS-DevTools/npm-publish@v4
    - name: Create Release
      if: ${{ steps.publish.outputs.type }}
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ steps.publish.outputs.version }}
        release_name: Release ${{ steps.publish.outputs.version }}
        body: ${{ steps.publish.outputs.version }}
        draft: false
        prerelease: false
 

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 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