Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .github/workflows/release-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,21 @@ jobs:
run: |
VERSION="${GITHUB_REF_NAME#v}"
TITLE="v${VERSION}"
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" artifacts/Second-mac-arm64.dmg artifacts/Second-mac-arm64.dmg.sha256 --repo "$GITHUB_REPOSITORY" --clobber
else
gh release create "$GITHUB_REF_NAME" artifacts/Second-mac-arm64.dmg artifacts/Second-mac-arm64.dmg.sha256 --repo "$GITHUB_REPOSITORY" --title "$TITLE" --notes "Second ${VERSION}"

if RELEASE_JSON="$(gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --json isDraft,isImmutable 2>/dev/null)"; then
IS_DRAFT="$(jq -r '.isDraft' <<< "$RELEASE_JSON")"
IS_IMMUTABLE="$(jq -r '.isImmutable' <<< "$RELEASE_JSON")"

if [[ "$IS_DRAFT" == "true" ]]; then
gh release upload "$GITHUB_REF_NAME" artifacts/Second-mac-arm64.dmg artifacts/Second-mac-arm64.dmg.sha256 --repo "$GITHUB_REPOSITORY" --clobber
gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --draft=false --latest --title "$TITLE" --notes "Second ${VERSION}"
elif [[ "$IS_IMMUTABLE" == "true" ]]; then
echo "::error::Release $GITHUB_REF_NAME is already published and immutable, so assets cannot be attached. Delete the GitHub Release and rerun this job, or create releases as drafts before this workflow runs."
exit 1
else
gh release upload "$GITHUB_REF_NAME" artifacts/Second-mac-arm64.dmg artifacts/Second-mac-arm64.dmg.sha256 --repo "$GITHUB_REPOSITORY" --clobber
fi
exit 0
fi

gh release create "$GITHUB_REF_NAME" artifacts/Second-mac-arm64.dmg artifacts/Second-mac-arm64.dmg.sha256 --repo "$GITHUB_REPOSITORY" --title "$TITLE" --notes "Second ${VERSION}"
Loading