From 312777bb9bac5d841e8f16ac78a021137775af10 Mon Sep 17 00:00:00 2001 From: Benoit Ranque Date: Tue, 15 Oct 2024 20:36:48 -0400 Subject: [PATCH] allow manual dispatch of tag action, error and abort if tag already exists --- .github/workflows/tag-release.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tag-release.yaml b/.github/workflows/tag-release.yaml index 1c5d233..0e1ba7c 100644 --- a/.github/workflows/tag-release.yaml +++ b/.github/workflows/tag-release.yaml @@ -6,6 +6,7 @@ on: - closed branches: - main + workflow_dispatch: jobs: build: @@ -28,6 +29,10 @@ jobs: run: | CARGO_VERSION="$(cargo metadata --format-version=1 | jq -r '.packages | .[] | select(.name == "ndc-clickhouse-cli") | .version')" VERSION_TAG="v$CARGO_VERSION" + if git rev-parse "$VERSION_TAG" >/dev/null 2>&1; then + echo >&2 "Error: Tag '$VERSION_TAG' already exists." + exit 1 + fi echo "Tagging $VERSION_TAG" git tag $VERSION_TAG git push --tags