Skip to content

fwilhe2/bump-version

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Bump Version

Gets the latest release version and increases it, useful for automatic releases.

Examples

Example workflow to release a new version with auto-incrementing version number

    - uses: fwilhe2/bump-version@main
      id: bump
    - run: echo ${{ steps.bump.outputs.newVersion }}

    - uses: actions/create-release@v1
      with:
        tag_name: ${{ steps.bump.outputs.newVersion }}

Update a specific version component

You can select the version component to update. By default, the minor version is updated. Valid values are major, minor, patch.

Example to update the patch version:

    - uses: fwilhe2/bump-version@main
      id: bump
      with:
        component: patch
    - run: echo ${{ steps.bump.outputs.newVersion }}

Configure version component via workflow_dispatch

If you want to select a version number component to update when triggering a release via workflow_dispatch, you might want to use inputs as in this example.

on:
  push:
  workflow_dispatch:
    inputs:
      component:
        description: 'Version component to increment'
        required: true
        default: 'patch'
jobs:
  build:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Get Version Number
      uses: fwilhe2/bump-version@main
      id: bump
      with:
        component: ${{ github.event.inputs.component }}

License

This software is released under the MIT License (MIT), see LICENSE for details.