name: Close release
on:
  workflow_dispatch:
    inputs:
      release_type:
        description: Version type after release
        required: true
        type: choice
        default: "patch"
        options:
          - rc
          - patch
          - minor
          - major
concurrency:
  group: release
  cancel-in-progress: false
jobs:
  build-library:
    name: Build Library
    uses: hoprnet/hopr-workflows/.github/workflows/build-library.yaml@build-library-v2
    permissions:
      contents: read
    with:
      source_branch: ${{ github.ref_name }}
      version_type: release
      architecture: x86_64-linux
      package_name: hopr-api
      runner: depot-ubuntu-24.04-4
    secrets:
      cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
      cargo_registry_token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
  release:
    name: Close release
    needs:
      - build-library
    runs-on: depot-ubuntu-24.04
    permissions:
      contents: write
    steps:
      - name: Release version
        uses: hoprnet/hopr-workflows/actions/release-version@4e3c270b51ed1817bc0b0f6996dfc8a7b0e757c1 # release-version-v2
        with:
          source_branch: ${{ github.ref_name }}
          release_type: ${{ inputs.release_type }}
          cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
          zulip_api_key: ${{ secrets.ZULIP_API_KEY }}
          zulip_email: ${{ secrets.ZULIP_EMAIL }}
          zulip_channel: HOPRd
          zulip_topic: Releases
          gcp_service_account: ${{ secrets.GCP_SA_GITHUB_RUNNER }}
          github_token: ${{ secrets.GH_RUNNER_TOKEN }}
