name: Publish to NPM

on:
  release:
    types: [created] # Se dispara cuando creas una "Release" en GitHub

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      # Usamos Bun ya que tu proyecto lo usa
      - uses: oven-sh/setup-bun@v1
        with:
          bun-version: latest

      - name: Install dependencies
        run: bun install

      - name: Authenticate with NPM
        run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

      - name: Publish to NPM
        run: npm publish --access public
