Skip to content

Version Bump

Version Bump #2

Workflow file for this run

name: Version Bump
on:
workflow_dispatch:
inputs:
bump_type:
description: "Version bump type"
required: true
type: choice
options:
- patch
- minor
- major
jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.WORKOS_BOT_APP_ID }}
private-key: ${{ secrets.WORKOS_BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Configure Git
run: |
git config user.name "workos-bot[bot]"
git config user.email "workos-bot[bot]@users.noreply.github.com"
- name: Read current version
id: current-version
run: |
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- name: Bump version
id: bump-version
run: |
CURRENT_VERSION="${{ steps.current-version.outputs.version }}"
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
case "${{ github.event.inputs.bump_type }}" in
major)
NEW_VERSION="$((MAJOR + 1)).0.0"
;;
minor)
NEW_VERSION="$MAJOR.$((MINOR + 1)).0"
;;
patch)
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
;;
esac
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Update version in pyproject.toml
run: |
sed -i 's/^version = ".*"/version = "${{ steps.bump-version.outputs.new_version }}"/' pyproject.toml
- name: Update uv.lock
run: uv lock
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: "v${{ steps.bump-version.outputs.new_version }}"
title: "v${{ steps.bump-version.outputs.new_version }}"
body: |
Bumps version from ${{ steps.current-version.outputs.version }} to ${{ steps.bump-version.outputs.new_version }}.
This PR was automatically created by the version-bump workflow.
branch: version-bump-${{ steps.bump-version.outputs.new_version }}
labels: version-bump