Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 27 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
name: Publish to npm
name: Publish

on:
push:
tags:
- 'v*'
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: read
contents: write
id-token: write

jobs:
publish:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v5
with:
node-version: 20
registry-url: https://registry.npmjs.org
ref: ${{ github.head_ref }}
fetch-depth: 0

- uses: oven-sh/setup-bun@v2
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.2'

- run: bun install --frozen-lockfile
bun-version: 1.2.18

- name: Verify tag matches package.json version
run: |
PKG_VERSION="v$(node -p "require('./package.json').version")"
GIT_TAG="${GITHUB_REF#refs/tags/}"
if [ "$PKG_VERSION" != "$GIT_TAG" ]; then
echo "Tag $GIT_TAG does not match package.json version $PKG_VERSION"
exit 1
fi

- run: bun run typecheck

- run: bun run lint
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'

- run: bun test
- name: Install dependencies
run: bun install --frozen-lockfile

- run: bun run build
- name: Build package
run: bun run build

- run: npm publish
- name: Publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}