A GitHub Action to automatically bump versions for any project that has a version file.
This action will automatically detect the version file and bump the version according to the release_type
input. If multiple version files are found, the action will use the one that is most commonly used for the project type.
The action will first try to detect the platform of the project by looking for common version files in the root directory. The following files are supported:
Platform | Version File |
---|---|
Deno | deno.json , jsr.json |
Docker | Dockerfile |
Go | go.mod |
Node | package.json |
PHP | composer.json |
Python | pyproject.toml , setup.py |
Rust | Cargo.toml |
If a version file is found, the action will bump the version in that file. If no version file is found, the action will fail.
You can also explicitly specify the platform to update by using the target_platform
input. This is useful for monorepos or projects with multiple potential manifest files.
To use this action in your workflow, add the following step:
- name: Bump version
uses: taj54/[email protected]
with:
release_type: 'patch' # patch, minor, or major
To bump a version in a specific directory, use the target_path
input:
- name: Bump version in my-app
uses: taj54/[email protected]
with:
release_type: 'patch'
target_path: 'my-app'
To explicitly target a platform, use the target_platform
input:
- name: Bump Node.js version
uses: taj54/[email protected]
with:
release_type: 'patch'
target_platform: 'node' # Explicitly target Node.js
For custom version updates in arbitrary files, use target_platform: 'custom'
along with the bump_targets
input. The bump_targets
input should be a JSON array of objects, where each object specifies the path
to the file and the variable
name containing the version.
For JSON files, the variable
should be the JSON path to the version field. For other text files, the variable
will be used in a regular expression to find and replace the version.
- name: Bump custom version
uses: taj54/[email protected]
with:
release_type: 'patch'
target_platform: 'custom'
bump_targets: |
[
{"path": "version.txt", "variable": "APP_VERSION"},
{"path": "config.json", "variable": "app.version"}
]
Name | Description | Default |
---|---|---|
release_type |
Select the version bump type (patch, minor, major) | patch |
git_tag |
Whether to create a Git tag after bump | true |
target_platform |
Explicitly specify the platform to update (e.g., node , python ). If not provided, the platform will be detected automatically. |
'' |
target_path |
The target path where the version bump should be applied. If not provided, the action will run in the root directory. | . |
bump_targets |
Optional list of version update targets. Provide the path and the variable to update, the Action will build regex automatically. Example: [{"path": "setup.py", "variable": "version"}, {"path": "Dockerfile", "variable": "APP_VERSION"}] |
[] |
Name | Description |
---|---|
new_version |
The new bumped version |
tag |
The created Git tag (if enabled) |
name: Version Bump
permissions:
contents: write
pull-requests: write
on:
workflow_dispatch:
inputs:
release_type:
description: 'Select version bump type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Universal Version Bump
uses: taj54/[email protected]
with:
release_type: ${{ inputs.release_type }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
For more information on how to develop this action, see the developer guide.
Contributions are welcome! Please see the contributing guidelines for more information.
This project is governed by the Code of Conduct.
This project is licensed under the MIT License - see the LICENSE file for details.