name: Releaser
run-name: ${{ github.actor }} is creating ${{vars.PRODUCT_NAME}} release ${{inputs.new_version}}
on:
  workflow_dispatch:
    inputs:
      release_type:
        description: |
          Release Type:
        required: true
        type: choice
        options:
          - STANDARD
          - SECURITY
          - HOTFIX
        default: STANDARD
      new_version:
        description: |
          New Version:
          Examples:
            20.4.0-rc1, 20.4.0-rc2, 20.4.0, 20.4.1
            certified-20.4-cert1-rc1, certified-20.4-cert1
        required: true
        type: string
      advisories:
        description: |
          Comma separated list of advisories for SECURITY releases.
          NO SPACES
          Example: GHSA-4xjp-22g4-9fxm,GHSA-4xjp-22g4-zzzz
        required: false
        type: string
      skip_cherry_pick:
        description: |
          Skip automatic cherry-pick for regular RC1 releases? USE WITH CAUTION!
        required: true
        type: boolean
        default: false
      force_cherry_pick:
        description: |
          Force cherry-pick for non-RC1 releases? USE WITH CAUTION!
        required: true
        type: boolean
        default: false
      skip_test_builds:
        description: |
          Skip test builds?  USE WITH CAUTION!
        required: true
        type: boolean
        default: false
      push_release_branches:
        description: |
          Push release branches live?
        required: true
        type: boolean
        default: false
      create_github_release:
        description: |
          Create the GitHub release?
        required: true
        type: boolean
        default: false
      push_tarballs:
        description: |
          Push tarballs to downloads server?
        required: true
        type: boolean
        default: false
      send_email:
        description: |
          Send announcement emails?
        required: true
        type: boolean
        default: false

jobs:
  Releaser:
    uses: asterisk/asterisk-ci-actions/.github/workflows/AsteriskRelease.yml@main
    with:
      release_type: ${{inputs.release_type}}
      new_version: ${{inputs.new_version}}
      advisories: ${{inputs.advisories}}
      skip_cherry_pick: ${{inputs.skip_cherry_pick}}
      force_cherry_pick: ${{inputs.force_cherry_pick}}
      skip_test_builds: ${{inputs.skip_test_builds}}
      push_release_branches: ${{inputs.push_release_branches}}
      create_github_release: ${{inputs.create_github_release}}
      push_tarballs: ${{inputs.push_tarballs}}
      send_email: ${{inputs.send_email}}
    secrets:
      gpg_private_key: ${{secrets.ASTDEV_GPG_PRIV_KEY}}
      asteriskteam_gh_token: ${{secrets.ASTERISKTEAM_PAT}}
      asteriskteam_email_username: ${{secrets.ASTERISKTEAM_SES_KEY_ID}}
      asteriskteam_email_secret: ${{secrets.ASTERISKTEAM_SES_KEY_SECRET}}
      deploy_ssh_priv_key: ${{secrets.DOWNLOADS_DEPLOY_SSH_PRIV_KEY}}
      deploy_ssh_username: ${{secrets.DOWNLOADS_DEPLOY_SSH_USERNAME}}
