From 30d94435b917ae31baefd0f95e56935a858aa71d Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Mon, 6 Feb 2023 09:31:06 -0300 Subject: [PATCH] chore: improve release detection As suggested here: https://github.com/cli/cli/issues/6964#issuecomment-1418495154 --- scripts/create_release.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/create_release.sh b/scripts/create_release.sh index 76c808e..039efd4 100755 --- a/scripts/create_release.sh +++ b/scripts/create_release.sh @@ -9,10 +9,10 @@ set -o nounset TAG="${TAG?}" -# First delete if release is there already -# https://github.com/cli/cli/issues/6964 -output=$(gh release delete "${TAG}" --cleanup-tag --yes 2>&1) || [[ "${output}" == "release not found" ]] -echo "${output}" +# Delete the release if it already exists +if gh release view "${TAG}" &>/dev/null; then + gh release delete "${TAG}" --cleanup-tag --yes 2>&1 +fi gh release create "${TAG}" --title "${TAG}" --target main --latest=false \ --notes "The original release notes can be found [here](https://github.com/koalaman/shellcheck/releases/tag/${TAG})." \