From 74b1af5cb2a7d73847b85aea1e5f039516557d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gremaud?= Date: Wed, 27 Nov 2024 23:26:45 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Update=20release=20workflow=20to=20?= =?UTF-8?q?get=20current=20version=20and=20bump=20version=20conditionally?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🛠️ Remove unused SSH key from release workflow * ✨ Add write permissions for contents in release workflow * ✨ Update release workflow to get current version and bump version conditionally --- .github/workflows/release.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a3f2091..21606a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,9 @@ on: types: - published +permissions: + contents: write + jobs: bump-version: runs-on: ubuntu-latest @@ -22,7 +25,11 @@ jobs: - name: Get release version run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - name: Bump version + - name: Get current version + run: echo "CURRENT_VERSION=$(uv run hatch version)" >> $GITHUB_ENV + + - name: Bump version if necessary + if: ${{ env.RELEASE_VERSION != env.CURRENT_VERSION }} run: uv run hatch version $RELEASE_VERSION - name: Commit and push changes