From f217a8444885df6c6ec28db4e19b8c135a987654 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Tue, 18 Oct 2022 11:32:52 -0500 Subject: [PATCH] :bug: Prevent draft release creation if release already exists --- build_and_release.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build_and_release.sh b/build_and_release.sh index 72cec75..0e3bb28 100755 --- a/build_and_release.sh +++ b/build_and_release.sh @@ -68,7 +68,10 @@ if [ -n "$GPG_FINGERPRINT" ]; then assets+=(checksums.txt checksums.txt.sig) fi -if ! gh release create "$tag" $prerelease --title="${GITHUB_REPOSITORY#*/} ${tag#v}" --generate-notes -- "${assets[@]}"; then - echo "trying to upload assets to an existing release instead..." +if gh release view "$tag" >/dev/null; then + echo "uploading assets to an existing release..." gh release upload "$tag" --clobber -- "${assets[@]}" +else + echo "creating release and uploading assets..." + gh release create "$tag" $prerelease --title="${GITHUB_REPOSITORY#*/} ${tag#v}" --generate-notes -- "${assets[@]}" fi