Skip to content

Create PR to prepare for Release #12

Create PR to prepare for Release

Create PR to prepare for Release #12

---
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 edax_runner 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@v3
- 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 <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