Skip to content

Bump Version

Bump Version #955

Workflow file for this run

name: Bump Version
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Calculate changes from the latest tag to HEAD
id: changes
run: |
LATEST_TAG=$(git describe --abbrev=0)
echo "latest-tag = $LATEST_TAG"
COUNT=$(git log $LATEST_TAG..HEAD --pretty=format:"%s" --no-merges \
--grep='^build:' \
--grep='^ci:' \
--grep='^feat:' \
--grep='^fix:' \
--grep='^docs:' \
--grep='^style:' \
--grep='^refactor:' \
--grep='^perf:' \
--grep='^test:' \
--grep='^revert:' \
--grep='^chore:' | awk 'END{print NR}')
echo "steps.changes.outputs.count = $COUNT"
echo "::set-output name=count::$COUNT"
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
default_bump: patch
if: steps.changes.outputs.count > 0
- name: Create a GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
if: steps.changes.outputs.count > 0