Skip to content

fix: fix release

fix: fix release #3

Workflow file for this run

name: Tag and Release
on:
push:
branches:
- main
jobs:
tag-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Git user
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Get latest tag
id: get_tag
run: |
latest_tag=$(git describe --tags --abbrev=0 || echo "v0.0.0")
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
- name: Bump version and create new tag
id: new_tag
run: |
latest="${{ steps.get_tag.outputs.latest_tag }}"
version="${latest#v}"
IFS='.' read -r major minor patch <<< "$version"
new_tag="v$major.$minor.$((patch + 1))"
git tag "$new_tag"
git push origin "$new_tag"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
- name: Generate changelog with git-cliff
uses: orhun/git-cliff-action@v2
with:
config: cliff.toml
args: -t ${{ steps.new_tag.outputs.new_tag }} -o CHANGELOG.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.new_tag.outputs.new_tag }}
name: Release ${{ steps.new_tag.outputs.new_tag }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}