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:
    if: "github.repository == 'google-gemini/gemini-cli'"
    environment: "${{ github.event.inputs.environment || 'prod' }}"
    strategy:
      fail-fast: false
      matrix:
        os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
    runs-on: '${{ matrix.os }}'
    permissions:
      contents: 'read'
      packages: 'write'
      issues: 'write'
    steps:
      - name: '📝 Print vars'
        shell: 'bash'
        run: 'echo "${{ toJSON(vars) }}"'
      - uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8'
        with:
          persist-credentials: false
      - 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 }}'
