Skip to content

Publish to npm

Publish to npm #9

Workflow file for this run

name: Publish to npm
on:
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: true
type: choice
options:
- patch
- minor
- major
permissions:
id-token: write
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: npm install -g npm@latest
- run: bun install --frozen-lockfile
- name: Bump version
run: npm version ${{ inputs.bump }} --no-git-tag-version
- name: Build
run: bun run build
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
VERSION=$(node -p "require('./package.json').version")
git add -A
git commit -m "v${VERSION}"
git tag "v${VERSION}"
git push && git push --tags
- name: Create GitHub Release
run: |
VERSION=$(node -p "require('./package.json').version")
gh release create "v${VERSION}" --generate-notes
env:
GH_TOKEN: ${{ github.token }}
- name: Publish to npm
run: npm publish --provenance
- name: Trigger Vercel deployment
run: curl -s -X POST "${{ secrets.VERCEL_DEPLOY_HOOK }}"