Skip to content

Commit

Permalink
Merge pull request #28 from gabe565/check-if-release-exists
Browse files Browse the repository at this point in the history
bug: Prevent draft release creation if release already exists
  • Loading branch information
mislav authored Oct 24, 2022
2 parents f6fe3e2 + f217a84 commit 397af79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build_and_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 397af79

Please sign in to comment.