name: NPM Publish

on:
  release:
    types: [published]

jobs:
  npm-publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
    - uses: actions/checkout@v5
    # Setup .npmrc file to publish to npm
    - uses: actions/setup-node@v6
      with:
        node-version: 24.x
        registry-url: 'https://registry.npmjs.org'
    # Ensure npm 11.5.1 or later is installed
    - run: npm install -g npm@latest
    - run: npm ci
    - run: npm run build --if-present
    - run: npm publish --provenance --access public

