This GitHub Action bumps the version number in your package.json
file.
- Automatically increments the version number.
- Supports major, minor, and patch increments.
- Easy to integrate into your CI/CD pipeline.
When the version number is bumped, the following reset logic is applied:
- If the
major
version is incremented, bothminor
andpatch
numbers are reset to0
.- Example:
1.2.3
becomes2.0.0
- Example:
- If the
minor
version is incremented, thepatch
number is reset to0
.- Example:
1.2.3
becomes1.3.0
- Example:
- If the
patch
version is incremented, no other numbers are reset.- Example:
1.2.3
becomes1.2.4
- Example:
To use this action, create a workflow file (e.g., .github/workflows/bump-version.yml
) in your repository:
# On demand workflow style
name: Bump Version
run-name: Bump "${{ inputs.bump-mode }}" version
on:
workflow_dispatch:
inputs:
bump-mode:
type: choice
description: "Bump mode"
required: true
default: "patch"
options:
- major
- minor
- patch
permissions:
contents: write
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Bump version
uses: gedclack/simple-bump-package-json@v1.0.0
id: bump-version
with:
bump-mode: ${{ github.event.inputs.bump-mode }}
- name: Commit & push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "Bump to v${{ steps.bump-version.outputs.new-version }}"
git push
bump-mode
: The mode of version bump to perform (major
,minor
,patch
). Default ispatch
.
new-version
: The new version number. e.g.,2.1.28
This project is licensed under the MIT License.