name: Prepare release
on:
  workflow_dispatch:
    inputs:
      version:
        description: The new version number
        required: true

jobs:
  compile_and_test:
    name: Update version and release notes
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        with:
          fetch-depth: 0 # We want the full history and all tags
      - name: Increment version for palette_derive
        uses: ./.github/actions/increment_version_number
        with:
          version: ${{ github.event.inputs.version }}
          crate: palette_derive
      - name: Increment version for palette
        uses: ./.github/actions/increment_version_number
        with:
          version: ${{ github.event.inputs.version }}
          crate: palette
          dependencies: '{"palette_derive": "${{ github.event.inputs.version }}"}'
      - name: Increment version in README.md
        run: 'sed -i ''s/\[Released\](https:\/\/docs.rs\/palette\/.*\/palette\/)/[Released](https:\/\/docs.rs\/palette\/${{ github.event.inputs.version }}\/palette\/)/'' README.md'
      - name: Generate release notes
        uses: ./.github/actions/generate_release_notes
        with:
          version: ${{ github.event.inputs.version }}
      - run: git diff

name: Prepare release
on:
  workflow_dispatch:
    inputs:
      version:
        description: The new version number
        required: true

jobs:
  compile_and_test:
    name: Update version and release notes
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.4
        with:
          fetch-depth: 0 # We want the full history and all tags
      - name: Increment version for palette_derive
        uses: ./.github/actions/increment_version_number
        with:
          version: ${{ github.event.inputs.version }}
          crate: palette_derive
      - name: Increment version for palette
        uses: ./.github/actions/increment_version_number
        with:
          version: ${{ github.event.inputs.version }}
          crate: palette
          dependencies: '{"palette_derive": "${{ github.event.inputs.version }}"}'
      - name: Increment version in README.md
        run: 'sed -i ''s/\[Released\](https:\/\/docs.rs\/palette\/.*\/palette\/)/[Released](https:\/\/docs.rs\/palette\/${{ github.event.inputs.version }}\/palette\/)/'' README.md'
      - name: Generate release notes
        uses: ./.github/actions/generate_release_notes
        with:
          version: ${{ github.event.inputs.version }}
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        with:
          message: Prepare release ${{ github.event.inputs.version }}
          branch: prepare_${{ github.event.inputs.version }}
          delete-branch: true
          title: Version ${{ github.event.inputs.version }}
          body: Prepare release ${{ github.event.inputs.version }}
          labels: internal

Make the prepare release workflow create a PR
Make the prepare release workflow create a PR
