name: Release

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version (major.minor.patch)'
        required: true
        type: string
      skip-branch-status-check:
        description: 'Skip CI status check.'
        default: false
        required: false
        type: boolean

permissions:
  actions: write
  contents: write

jobs:
  release:
    environment: deploy-release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          token: ${{ secrets.GH_PUSH_TOKEN }}  # this token works to push to the protected main branch.
      - uses: actions/setup-node@v6.3.0
        with:
          node-version-file: .github/node-version.txt
      - uses: mhils/workflows/setup-python@8fe88b311a66c441e01edfebe4cd90d8a47fa335
      - run: ./release/release.py ${{ inputs.version }} ${{ inputs.skip-branch-status-check }}
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # this token works with the GraphQL API
