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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # 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 }}