Bump version numbers across several files
Project description
Version Bumper
A tool for developers to instantly bump version numbers in project files. It can be used locally or as a GitHub Action.
Features
- Bump major, minor, or patch versions (semantic versioning)
- Automatically creates Git tags
- Creates and updates a changelog file with list of commits since the last git tag
- Can be used as a GitHub Action or from the command line
Installation
Install the package using pip:
pip install simplebumpversion
Usage
CLI Usage
If you want to bump the version number in setup.py,
# Bump patch version (default)
bump-version setup.py # bumps 1.2.3 -> 1.2.4
# Specific bump types
bump-version setup.py --major # bumps 1.2.3 -> 2.0.0
bump-version setup.py --minor # bumps 1.2.3 -> 1.3.0
bump-version setup.py --patch # bumps 1.2.3 -> 1.2.4
# Pass several files to update
bump-version setup.py README.md --patch
GitHub Action Usage
name: Bump Version
on:
push:
branches: [main]
# give permission to write and push commits
permissions:
contents: write
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required for git versioning
- name: Bump version
uses: Ikromov247/bump_version@v2.1.0
with:
files: 'package.json' # file containing your package version number
bump_type: 'patch' # Options: major, minor, patch, git
force: true # Optional: Force version change when current version is a git tag
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Bump version"
git push
Config file
You can also add your configurations in a yaml file instead of passing them as arguments.
If you pass both the config file and the arguments, config file takes precedence and cli arguments will be ignored.
Example configuration file:
name: 'Patch bump' # Configuration name
description: 'Bump the patch version in setup.py and README.md' # description
settings:
bump_type: patch
files: # list of files to update
- setup.py
- README.md
force: false # Set to true to force version change when current version is a git tag
In cli, pass the path to config file as an argument:
bump-version --config config.yml
Or use it in Github Actions workflow file:
- name: Bump version
uses: Ikromov247/bump_version@v2.1.0
with:
config: bump_config.yml
Supported Version Formats
The tool recognizes uses regex to recognize various version patterns:
version = "1.2.3"VERSION = "1.2.3"__version__ = "1.2.3""version": "1.2.3"(for JSON/package.json)
Common errors
-
Invalid version format:
- Reason: the tool could not find the version number. Your version possibly does not match supported patterns.
-
File or permission errors:
- Reason: the tool could not open or write to specified files.
- Solution: check file paths and permissions.
-
Config file is invalid:
- Reason: your config file does not have required fields.
- Solution: check the sample config file for reference.
-
Major version bumping is not supported:
- Reason: Bumping major versions is only possible through cli to prevent accidental major version bumps.
- Solution: Use cli for major version bumps or set a different bump type
-
Error occured when reading the git tag:
- Reason: your repo does not have tags.
- Solution: create a tag.
Contributing
If you want to contribute, start from checking the todo file and the CONTRIBUTING.MD for rules.
To suggest new features, create an issue with the tag enhancement.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplebumpversion-3.0.0.tar.gz.
File metadata
- Download URL: simplebumpversion-3.0.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73c666efdf8a9f1154c8edb89fc95e26be6777fa1b257029962b65e694ce361d
|
|
| MD5 |
b9a2513c2b347cafd166cb1f45882c34
|
|
| BLAKE2b-256 |
56b026a0d3319c6b32893bbe7eaff535ea9d28f457a8761601929e073d7e1fef
|
Provenance
The following attestation bundles were made for simplebumpversion-3.0.0.tar.gz:
Publisher:
python-publish.yml on Ikromov247/bump_version
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplebumpversion-3.0.0.tar.gz -
Subject digest:
73c666efdf8a9f1154c8edb89fc95e26be6777fa1b257029962b65e694ce361d - Sigstore transparency entry: 232351298
- Sigstore integration time:
-
Permalink:
Ikromov247/bump_version@ba8312f6d0a94eac38621a37c7aceb5f38bbd10a -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/Ikromov247
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ba8312f6d0a94eac38621a37c7aceb5f38bbd10a -
Trigger Event:
release
-
Statement type:
File details
Details for the file simplebumpversion-3.0.0-py3-none-any.whl.
File metadata
- Download URL: simplebumpversion-3.0.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
986c546f4c3436f4420e8dead43cfd5f812b0a417520d661f752a441a6a9da5c
|
|
| MD5 |
50c2e03aa0487cb899bf899b4484adbe
|
|
| BLAKE2b-256 |
ecf11d0480d2d6160ca3e725626e9a5ff999d138b3727767704321db84697901
|
Provenance
The following attestation bundles were made for simplebumpversion-3.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on Ikromov247/bump_version
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplebumpversion-3.0.0-py3-none-any.whl -
Subject digest:
986c546f4c3436f4420e8dead43cfd5f812b0a417520d661f752a441a6a9da5c - Sigstore transparency entry: 232351299
- Sigstore integration time:
-
Permalink:
Ikromov247/bump_version@ba8312f6d0a94eac38621a37c7aceb5f38bbd10a -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/Ikromov247
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ba8312f6d0a94eac38621a37c7aceb5f38bbd10a -
Trigger Event:
release
-
Statement type: