Skip to content

Bump version (patch) #12

Bump version (patch)

Bump version (patch) #12

Workflow file for this run

name: Bump version
run-name: Bump version (${{ github.event.inputs.bump_rule }})
on:
workflow_dispatch:
inputs:
bump_rule:
description: 'Bump rule'
required: true
default: 'patch'
type: choice
options:
- 'patch'
- 'minor'
- 'major'
env:
PYTHON_VERSION: "3.11"
jobs:
bump-version:
name: Bump version
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new_version: ${{ steps.bump-version.outputs.new_version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Bump version
id: bump-version
run: |
new_version=$(poetry version --short ${{ github.event.inputs.bump_rule }})
echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
echo "Bumped version to v$new_version" >> $GITHUB_STEP_SUMMARY
- name: Commit and push
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Bump version to v${{ steps.bump-version.outputs.new_version }}"
new_branch: "bump-version/v${{ steps.bump-version.outputs.new_version }}"
create-pull-request:
name: Create pull request if on main
runs-on: ubuntu-latest
needs: bump-version
if: github.ref == 'refs/heads/main'
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Create pull request if on main
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr create --repo ${{ github.repository }} --base main --head "bump-version/v${{ needs.bump-version.outputs.new_version }}" --title "Bump version to v${{ needs.bump-version.outputs.new_version }}" --body "Bump version to v${{ needs.bump-version.outputs.new_version }}"