Gets the latest release version and increases it, useful for automatic releases.
- 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 }}
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 }}
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 }}
This software is released under the MIT License (MIT), see LICENSE for details.