name: release
run-name: "${{ inputs.version }}"
on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Increment "major", "minor", "patch", or "pre*" version; or specify version'
        default: patch
        required: true
jobs:
  main:
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: write
      packages: write
    steps:
      - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
        with:
          node-version: lts/*
          cache: npm
          registry-url: https://registry.npmjs.org/
      - run: npm ci
      - run: npm test
      - name: Release
        run: |
          git config user.email "${{ github.actor }}@users.noreply.github.com"
          git config user.name "${{ github.actor }}"
          npm run release -- "${{ github.event.inputs.version }}"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}