From ec084753631ef20ee2136a3b67cd50c1072fc85a Mon Sep 17 00:00:00 2001 From: Igor Date: Mon, 24 Mar 2025 10:44:54 +0100 Subject: [PATCH] Fix version bumper --- .../.github/workflows/merge-pr.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.github/workflows/merge-pr.yaml b/{{cookiecutter.project_slug}}/.github/workflows/merge-pr.yaml index 5b4735cba..7a8484aa1 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/merge-pr.yaml +++ b/{{cookiecutter.project_slug}}/.github/workflows/merge-pr.yaml @@ -25,7 +25,11 @@ jobs: id: latest_version shell: bash run: | - LATEST_VERSION=$(git tag --sort=-creatordate | head -n 1) + LATEST_VERSION="$(git tag --sort=-creatordate | head -n 1)" + if [ -z "$LATEST_VERSION" ]; then + echo "No tags found. Using version from __init__ file" + LATEST_VERSION=$(grep -oP '__version__ = "\K[^"]+' {{cookiecutter.project_slug}}/__init__.py) + fi echo "Found current version: ${LATEST_VERSION}" echo "version=${LATEST_VERSION}" >> "$GITHUB_OUTPUT"