You can test out Konsentus/action.bump-version-and-tag
:
This action will find the last version tag made on the current branch, bump it and tag the current commit with the new version.
If a package.json file is present, the version contained will also be bumped to the same version as the tag.
As tags are commit specific and not branch specific, these version tags are prefixed with the current branch name, e.g. master/v1.0.0.
Example
name: Bump Version and Tag
on:
push:
branches:
- 'master'
- 'sit'
- 'alpha'
- 'sandbox'
jobs:
bump-and-tag:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Bump and Tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Tags
run: git fetch origin +refs/tags/*:refs/tags/*
- name: Bump Version
id: bump_and_tag
uses: konsentus/action.bump-version-and-tag@v2