⬆️ Bump Version
Overview
This GitHub Action automates the process of bumping the project version. It allows users to choose whether to increment the version as a patch, minor, or major release. This workflow consists of two main jobs:
- Test: Runs tests before bumping the version.
- Bump Version: Increases the project version and commits the changes.
How It Works
The workflow is triggered manually via GitHub's workflow_dispatch event. Users must select the type of version bump before execution.
Workflow Configuration
Trigger
The action is triggered manually by dispatching a workflow with an input parameter bump_type, which can have one of the following values:
patchminormajor
Jobs
1. Test (1.1. Test)
This job ensures the code is tested before making version changes.
- Runs on:
ubuntu-24.04 - Permissions:
contents: read - Steps:
- Checkout the repository
- Install dependencies (from
requirements/requirements.test.txt) - Run tests using
pytestvia./scripts/test.sh -l
2. Bump Version (1.2. Bump Version)
This job updates the project version after tests pass.
- Runs on:
ubuntu-24.04 - Permissions:
contents: write - Steps:
- Checkout the repository (with full history)
- Bump the version using
./scripts/bump-version.sh - Commits and pushes changes using GitHub Actions bot
Usage
To manually trigger this workflow:
- Navigate to the repository on GitHub.
- Go to the Actions tab.
- Select "1. Bump Version" from the list.
- Click "Run workflow".
- Choose a version bump type (
patch,minor, ormajor). - Click "Run workflow" to start the process.
Environment Variables
The workflow uses the following environment variables:
GITHUB_TOKEN: GitHub-provided authentication token for making commits.
Scripts Used
test.sh: Runs the test suite.bump-version.sh: Handles version incrementing.
Notes
- Ensure that
bump-version.shsupports-b,-c, and-poptions. - The workflow ensures that version bumping occurs only if tests pass.
- The changes are committed and pushed automatically to the repository.
Troubleshooting
- If the workflow fails in the
teststep, check test logs for errors. - If version bumping fails, ensure
bump-version.shis executable and correctly configured. - If permissions errors occur, verify that GitHub Actions has the required
contents: writepermission.