feature: add syntax highlight and enchancements: #47 and fix: #45, no… #94
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: Create Tag and Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, 'no-release') }} | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get latest tag | |
id: get_latest_tag | |
run: echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
- name: Bump version and push tag | |
id: tag_version | |
run: | | |
latest_tag=${{ steps.get_latest_tag.outputs.latest_tag }} | |
if [[ $latest_tag =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then | |
major=${BASH_REMATCH[1]} | |
minor=${BASH_REMATCH[2]} | |
patch=${BASH_REMATCH[3]} | |
new_tag="v$major.$minor.$((patch + 1))" | |
else | |
new_tag="v1.5.1" | |
fi | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git tag $new_tag | |
git push origin $new_tag | |
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag_version.outputs.new_tag }} | |
release_name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: | | |
Changes in this Release | |
- Automated patch version bump | |
draft: false | |
prerelease: false |