name: Publish to npm

# Publish model: main is the release branch. A push to main publishes only if
# package.json's version isn't on npm yet (otherwise a clean no-op), then tags
# v<version> and creates a GitHub Release. See johnhenry/workflows' README.
on:
  push:
    branches: [main]
  workflow_dispatch: {}

concurrency:
  group: publish-${{ github.ref }}
  cancel-in-progress: false

jobs:
  publish:
    permissions:
      contents: write # tag + GitHub Release by-product of npm-publish.yml
      id-token: write # npm provenance
    uses: johnhenry/workflows/.github/workflows/npm-publish.yml@v1
    with:
      node-version: "26"
      gate-commands: npm test
    secrets: inherit
