From 75350e76e487ed7db210e3274594642bb0925b49 Mon Sep 17 00:00:00 2001 From: Andre Toropchin Date: Mon, 30 Jun 2025 15:21:05 +0200 Subject: [PATCH] Skip target when creating a tag if already exists --- scripts/run-tag-release.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/run-tag-release.sh b/scripts/run-tag-release.sh index cc6d5f6..af7f06b 100755 --- a/scripts/run-tag-release.sh +++ b/scripts/run-tag-release.sh @@ -18,9 +18,14 @@ do version=$(grep '^version:' pubspec.yaml | awk '{print $2}') tag="$project_folder-$version" - echo -e "$TAG_COLOR Creating Git tag: $tag for $project_folder and version $version" - git tag "$tag" - git push origin "$tag" + # Check if the tag already exists + if git rev-parse "$tag" >/dev/null 2>&1; then + echo -e "${RED}Tag $tag already exists. Skipping...${NC}" + else + echo -e "$TAG_COLOR Creating Git tag: $tag for $project_folder and version $version" + git tag "$tag" + git push origin "$tag" + fi cd .. done