Create PR to prepare for Release #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Create PR to prepare for Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_bump_part: | |
| type: choice | |
| description: 'version bump part' | |
| default: minor | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| - breaking | |
| required: true | |
| # I don't describe libedax4dart CHANGELOG with large text and I decided to implement simple workflow. | |
| changelog_description: | |
| type: string | |
| description: 'description for CHANGELOG' | |
| default: 'upgrade dependencies.' | |
| required: true | |
| jobs: | |
| create_release_pr: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dart-lang/setup-dart@v1 | |
| - name: bump version | |
| run: dart pub bump ${{ github.event.inputs.version_bump_part }} | |
| - name: inject current version | |
| run: echo "CURRENT_VERSION=$(dart pub deps --style compact | grep "libedax4dart" | grep -Eo '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}')" >> $GITHUB_ENV | |
| - name: update CHANGELOG | |
| run: | | |
| TMP_FILE="CHANGELOG.md.tmp" | |
| echo "# ${{ env.CURRENT_VERSION }}" >> "${TMP_FILE}" | |
| echo "" >> "${TMP_FILE}" | |
| echo "${{ github.event.inputs.changelog_description }}" >> "${TMP_FILE}" | |
| echo "" >> "${TMP_FILE}" | |
| cat CHANGELOG.md >> "${TMP_FILE}" | |
| cat "${TMP_FILE}" > CHANGELOG.md | |
| rm "${TMP_FILE}" | |
| # See: https://github.com/peter-evans/create-pull-request/tree/master#reference-example | |
| - name: create PR | |
| id: create_pull_request | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| # See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs | |
| # See: https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-537478081 | |
| token: ${{ secrets.PAT }} | |
| # See: https://github.com/peter-evans/create-pull-request/issues/593 | |
| committer: GitHub <noreply@github.com> | |
| author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
| commit-message: 'Prepare for new Release ${{ env.CURRENT_VERSION }}' | |
| title: 'Prepare for new Release `${{ env.CURRENT_VERSION }}`' | |
| body: | | |
| Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) | |
| --- | |
| See: https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#triggering-further-workflow-runs | |
| branch: prepare_for_release | |
| delete-branch: true | |
| # See: https://github.com/peter-evans/create-pull-request/tree/main#auto-merge | |
| - name: enable auto-merge | |
| if: steps.create_pull_request.outputs.pull-request-operation == 'created' | |
| uses: peter-evans/enable-pull-request-automerge@v3 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }} | |
| merge-method: squash |