name: 'Verify NPM release tag'

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'The expected Gemini binary version that should be released (e.g., 0.5.0-preview-2).'
        required: true
        type: 'string'
      npm-tag:
        description: 'NPM tag to verify'
        required: true
        type: 'choice'
        options:
          - 'dev'
          - 'latest'
          - 'preview'
          - 'nightly'
        default: 'latest'
      environment:
        description: 'Environment'
        required: false
        type: 'choice'
        options:
          - 'prod'
          - 'dev'
        default: 'prod'

jobs:
  verify-release:
    environment: "${{ github.event.inputs.environment || 'prod' }}"
    runs-on: 'ubuntu-latest'
    permissions:
      contents: 'read'
      packages: 'write'
      issues: 'write'
    steps:
      - name: '📝 Print vars'
        shell: 'bash'
        run: 'echo "${{ toJSON(vars) }}"'
      - uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8'
      - name: 'Verify release'
        uses: './.github/actions/verify-release'
        with:
          npm-package: '${{vars.CLI_PACKAGE_NAME}}@${{github.event.inputs.npm-tag}}'
          expected-version: '${{github.event.inputs.version}}'
          working-directory: '.'
          gemini_api_key: '${{ secrets.GEMINI_API_KEY }}'
          npm-registry-url: '${{ vars.NPM_REGISTRY_URL }}'
          github-token: '${{ secrets.GITHUB_TOKEN }}'
          npm-registry-scope: '${{ vars.NPM_REGISTRY_SCOPE }}'
