name: "Publish to npm"
on:
  release:
    types: [released]
jobs:
  publish:
    environment: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          # "ref" specifies the branch to check out.
          # "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted
          ref: ${{ github.event.release.target_commitish }}
      - name: Use Node.js v16
        uses: actions/setup-node@v4
        with:
          node-version: 24
          registry-url: https://registry.npmjs.org/ # Specifies the registry, this field is required!
      - run: npm ci
      - run: npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}
