Skip to content

Commit b37ce55

Browse files
authored
ci: Prevent duplicate tag creation in release workflow
Add check to skip tag creation if it already exists Signed-off-by: Eric Deandrea <eric.deandrea@ibm.com>
1 parent 63cf32e commit b37ce55

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ jobs:
9595
env:
9696
JRELEASER_TAG_NAME: "v${{ env.CURRENT_VERSION }}"
9797
run: |
98+
set -euo pipefail
99+
100+
if git ls-remote --tags origin "${JRELEASER_TAG_NAME}" | grep -q .; then
101+
echo "Tag ${JRELEASER_TAG_NAME} already exists on origin; skipping tag creation."
102+
exit 0
103+
fi
104+
98105
git tag ${{ env.JRELEASER_TAG_NAME }}
99106
git push origin ${{ env.JRELEASER_TAG_NAME }}
100107

0 commit comments

Comments
 (0)