name: Release To Packagist
run-name: ${{ github.event.inputs.Title }} (${{ github.event.inputs.Version }})
on:
  workflow_dispatch:
    inputs:
      Version:
        description: "Version to be released in format: x.y.z, where x => major version, y => minor version and z => patch version"
        required: true
        default: "0.1.0"
      Title:
        description: "Title of the release"
        required: true
        default: "Releasing HttpClient improvements"
jobs:
  create-release:
    name: Creating release version ${{ github.event.inputs.Version }}
    runs-on: ubuntu-latest
    environment: Production
    steps:
      - uses: actions/checkout@v3

      - name: Create Tag
        id: tag_version
        uses: mathieudutour/github-tag-action@v6.0
        with:
          github_token: ${{ secrets.TAGS_TOKEN }}
          custom_tag: ${{ github.event.inputs.Version }}
          tag_prefix: ""

      - name: Create Release
        uses: ncipollo/release-action@v1
        with:
          tag: ${{ steps.tag_version.outputs.new_tag }}
          name: ${{ github.event.inputs.Title }}
          body: ${{ steps.tag_version.outputs.changelog }}
