Version bump #60
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: Version bump | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
inputs: | |
versionPart: | |
description: "Version bump part" | |
required: true | |
default: patch | |
type: choice | |
options: | |
- prepatch | |
- patch | |
- minor | |
- major | |
jobs: | |
deploy: | |
name: Version bump on release branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Add Poetry Version for __init__.py | |
run: poetry self add poetry-bumpversion | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: "poetry" | |
- name: Setup git config | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git checkout -b release | |
- name: Bump Version | |
id: bump_version | |
run: | | |
VERSION=$(poetry version --short) | |
poetry version ${{ github.event.inputs.versionPart }} | |
BUMPED_VERSION=$(poetry version --short) | |
echo "BUMPED_VERSION=$BUMPED_VERSION" >> $GITHUB_OUTPUT | |
echo "PRE_BUMP_VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- name: Commiting Version change | |
run: | | |
git add --all | |
git commit -m "🔖 Package ${{ steps.bump_version.outputs.PRE_BUMP_VERSION }} to ${{ steps.bump_version.outputs.BUMPED_VERSION }}" | |
- name: Git push | |
run: | | |
git push origin release | |
- name: Create Pull Request | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { repo, owner } = context.repo; | |
const result = await github.rest.pulls.create({ | |
title: '🔖 Bump to Version: ${{ steps.bump_version.outputs.BUMPED_VERSION }}', | |
owner, | |
repo, | |
head: 'release', | |
base: 'main', | |
body: [ | |
'Bumps Package Version ${{ steps.bump_version.outputs.PRE_BUMP_VERSION }} --> ${{ steps.bump_version.outputs.BUMPED_VERSION }}', | |
"", | |
"# What's new?", | |
"- " | |
].join('\n') | |
}); | |
github.rest.issues.addLabels({ | |
owner, | |
repo, | |
issue_number: result.data.number, | |
labels: ['release', 'automated pr', 'auto-release'] | |
}); |