File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,13 +68,23 @@ jobs:
6868 set -euo pipefail
6969 TAG="v${{ steps.version.outputs.version }}"
7070 ASSET="release/Stave-macOS.zip"
71- if gh release view "$TAG" >/dev/null 2>&1; then
71+
72+ set +e
73+ RELEASE_VIEW_OUTPUT=$(gh release view "$TAG" 2>&1)
74+ RELEASE_VIEW_STATUS=$?
75+ set -e
76+
77+ if [ "$RELEASE_VIEW_STATUS" -eq 0 ]; then
7278 echo "Release $TAG already exists; updating asset."
7379 gh release upload "$TAG" "$ASSET" --clobber
74- else
80+ elif printf '%s\n' "$RELEASE_VIEW_OUTPUT" | grep -Eqi '404|release not found'; then
7581 echo "Creating release $TAG."
7682 gh release create "$TAG" \
7783 --title "$TAG" \
7884 --generate-notes \
7985 "$ASSET"
86+ else
87+ echo "Failed to query release $TAG with gh:" >&2
88+ printf '%s\n' "$RELEASE_VIEW_OUTPUT" >&2
89+ exit "$RELEASE_VIEW_STATUS"
8090 fi
You can’t perform that action at this time.
0 commit comments