Create PR to prepare for Release #12
This file contains 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 | |
required: true | |
# Although I can use https://github.com/f3ath/cider#changelog, I don't describe pedantic_sensuikan1973 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@v4 | |
- uses: dart-lang/setup-dart@v1 | |
- name: bump version | |
run: dart run cider bump ${{ github.event.inputs.version_bump_part }} | |
- name: inject current version | |
run: echo "CURRENT_VERSION=$(dart run cider version)" >> $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@v5 | |
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 <[email protected]> | |
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 |