name: Publish to npm

on:
  push:
    tags:
      - 'v*'

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

      - uses: oven-sh/setup-bun@v2
        with:
          bun-version: latest

      - run: bun install

      - run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

      - run: npm publish --access=public
