Bump Version #9
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: Bump Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version_type: | |
description: "Version increment type (patch, minor, major)" | |
required: true | |
default: patch | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
bump_version: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Configure Git | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
# Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
pip install bumpversion setuptools wheel build | |
# Run bumpversion | |
- name: Bump version | |
id: bump_version | |
run: | | |
bumpversion --allow-dirty ${{ github.event.inputs.version_type }} | |
NEW_VERSION=$(git describe --tags --abbrev=0) | |
echo "New version is $NEW_VERSION" | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
# Push changes and tag | |
- name: Push changes and tag | |
run: | | |
git push origin HEAD | |
git push origin --tags |