Bump Version #1414
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bump Version | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
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 "count=$COUNT" >> $GITHUB_OUTPUT | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
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 |