name: Create Release Commit & Changelog

on:
  workflow_dispatch:
    inputs:
      tag:
        description: Tag to Create & Create Changelog At.
        required: true
      release_type:
        description: Release Type.
        type: choice
        required: true
        default: 'Release'
        options:
          - 'Release'
          - 'Beta Release'
          - 'Alpha Release'
      compare_tag:
        description: Tag(s) to compare against. If not set, will use the tag before `Tag`. If specifying multiple, seperate by commas. (Spaces allowed).
        required: false
      branch:
        description: Branch to push changelog to. If not set, changelog will just be uploaded as an artifact.
        required: false

jobs:
  releaseCommit:
    name: Create Release Commit (${{ inputs.tag }})
    uses: ./.github/workflows/releasecommit.yml
    with:
      tag: ${{ inputs.tag }}
      release_type: ${{ inputs.release_type }}
    secrets: inherit
    
  createChangelog:
    name: Create Changelog (${{ inputs.tag }})
    needs: releaseCommit
    uses: ./.github/workflows/createchangelog.yml
    with:
      tag: ${{ inputs.tag }}
      release_type: ${{ inputs.release_type }}
      compare_tag: ${{ inputs.compare_tag }}
      branch: ${{ inputs.branch }}
    secrets: inherit
