Skip to content

Release - NPM Publish (Reusable + Debug) #16

Release - NPM Publish (Reusable + Debug)

Release - NPM Publish (Reusable + Debug) #16

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g. 1.2.3)"
required: true
type: string
jobs:
publish:
runs-on: ubuntu-latest
environment: npm
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ inputs.version || github.ref_name }}
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- uses: actions/cache@v5
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
restore-keys: ${{ runner.os }}-bun-
- run: bun install --frozen-lockfile
- name: Set version from tag
run: npm version "${{ inputs.version || github.ref_name }}" --no-git-tag-version --allow-same-version
- run: bun run check
- run: bun run typecheck
- run: bun test
- run: bun run build
- run: npm publish --access public