name: Make Release
on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version Number'     
        required: true
        type: string
      info:
        description: 'Description of this Release'
        required: true
        type: string

jobs:
  make-release:
    runs-on: ubuntu-latest
    name: Create Release
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set up JDK 8
        uses: actions/setup-java@v2
        with:
          java-version: '8'
          distribution: 'adopt'
          cache: maven

      - name: Set Version
        uses: bluwy/substitute-string-action@v1
        with:
          _input-file: 'pom.xml'
          _format-key: '>key<'
          Snapshot: ${{ inputs.version }}

      - name: Build with Maven
        run: mvn --batch-mode --update-snapshots verify
      
      - name: Rename jar
        run: mv target/*-All.jar JMusicBot-${{ inputs.version }}.jar

      - name: Create Release
      - uses: ncipollo/release-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ inputs.version }}
          name: Version ${{ inputs.version }}
          draft: true
          prerelease: false
          artifacts: "*.jar"
          body: |
            ${{ inputs.info }}
            ---
            ### Setup
            https://jmusicbot.com/setup  
            https://jmusicbot.com/config  
            # Download *only* the `.jar` file below!
