bump: minor #53
Workflow file for this run
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: | |
push: | |
branches-ignore: | |
- main | |
workflow_dispatch: | |
inputs: | |
bump-type: | |
description: 'Bump type to use if commit message directive is not found' | |
required: false | |
default: '' | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Set up Git config | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
- name: Determine bump type from commit message | |
id: determine_bump | |
run: | | |
# Get the most recent commit message | |
commit_message=$(git log -1 --pretty=%B) | |
echo "Commit message: $commit_message" | |
bump_type="" | |
if echo "$commit_message" | grep -iq "bump: major"; then | |
bump_type="major" | |
elif echo "$commit_message" | grep -iq "bump: minor"; then | |
bump_type="minor" | |
elif echo "$commit_message" | grep -iq "bump: patch"; then | |
bump_type="patch" | |
fi | |
# If no directive is found and this is a workflow_dispatch event with input, use that input. | |
if [ -z "$bump_type" ]; then | |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.bump-type }}" ]; then | |
bump_type="${{ github.event.inputs.bump-type }}" | |
else | |
bump_type="none" | |
fi | |
fi | |
echo "Determined bump type: $bump_type" | |
echo "bump_type=$bump_type" >> $GITHUB_OUTPUT | |
touch requirements.txt | |
- name: Bump version | |
id: bump | |
if: steps.determine_bump.outputs.bump_type != 'none' | |
uses: callowayproject/bump-my-version@master | |
env: | |
BUMPVERSION_TAG: "true" | |
with: | |
args: ${{ steps.determine_bump.outputs.bump_type }} | |
github-token: ${{ secrets.PAT }} | |
- name: Skip bumping | |
if: steps.determine_bump.outputs.bump_type == 'none' | |
run: echo "No bump directive found in commit message or manual input. Skipping version bump." | |
- name: Check | |
if: steps.bump.outputs.bumped == 'true' | |
run: | | |
echo "Version was bumped from ${{ steps.bump.outputs.previous-version }} to ${{ steps.bump.outputs.current-version }}!" |