From 63b263f995791b7271b8ac34649d1420a547f6f1 Mon Sep 17 00:00:00 2001 From: Darp Alakun Date: Mon, 6 Jan 2025 14:13:53 -0500 Subject: [PATCH] chore: add GitHub Actions workflow to synchronize version after tag creation --- .github/workflows/merge-post.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/merge-post.yml b/.github/workflows/merge-post.yml index e2ac0f419..a3e66ee1b 100644 --- a/.github/workflows/merge-post.yml +++ b/.github/workflows/merge-post.yml @@ -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: |