name: Manual Release

on:
  workflow_dispatch:
    inputs:
      release_reason:
        description: 'Short reason for this manual release'
        required: true

jobs:
  regular-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: main
          token: ${{ secrets.JINA_DEV_BOT }}
          fetch-depth: 100
      - uses: actions/setup-python@v2
        with:
          python-version: 3.7
      - run: |
          npm install git-release-notes
          pip install twine wheel
          ./scripts/release.sh final "${{ github.event.inputs.release_reason }}" "${{github.actor}}"
        env:
          TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
          TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
          JINA_SLACK_WEBHOOK: ${{ secrets.JINA_SLACK_WEBHOOK }}
      - if: failure()
        run: echo "nothing to release"
      - name: bumping main version
        uses: ad-m/github-push-action@v0.6.0
        with:
          github_token: ${{ secrets.JINA_DEV_BOT }}
          tags: true
          branch: main