chore: add GitHub Actions workflow to synchronize version after tag creation

This commit is contained in:
Prad Nukala 2025-01-06 14:13:53 -05:00
parent 8919019bf3
commit 63b263f995

View File

@ -13,6 +13,38 @@ permissions:
issues: write
jobs:
sync-version:
name: Sync Version
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: "${{ secrets.COMMIT_KEY }}"
- name: Update Version
run: |
# Get tag without 'v' prefix
TAG_VERSION=${GITHUB_REF#refs/tags/v}
# Update version in .cz.toml
sed -i "s/^version = \".*\"/version = \"$TAG_VERSION\"/" .cz.toml
# Configure git
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# Commit and push if there are changes
if git diff --quiet; then
echo "Version already synchronized"
else
git add .cz.toml
git commit -m "chore: sync version to ${TAG_VERSION} [skip ci]"
git push origin main
fi
bump-version:
name: Cz Bump
if: |