Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,16 @@ jobs:
run: |
VERSION="${GITHUB_REF_NAME#v}"
DMG="Distribution/Insomnia-${VERSION}.dmg"
DMG_ROOT="${RUNNER_TEMP}/insomnia-dmg"

rm -rf "${DMG_ROOT}"
mkdir -p "${DMG_ROOT}"
ditto Distribution/Insomnia.app "${DMG_ROOT}/Insomnia.app"
ln -s /Applications "${DMG_ROOT}/Applications"

hdiutil create \
-volname "Insomnia" \
-srcfolder Distribution/Insomnia.app \
-srcfolder "${DMG_ROOT}" \
-ov \
-format UDZO \
"${DMG}"
Expand Down
5 changes: 3 additions & 2 deletions Sources/Insomnia/Update/UpdateChecker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@ final class UpdateChecker {
}
}

// MARK: - Download and Install
// MARK: - Download Update

/// Downloads the latest DMG and opens it for the user to install.
///
/// The DMG is saved to `~/Downloads` and automatically mounted
/// via `NSWorkspace` so the user can drag the app to Applications.
/// File I/O is performed off the main thread to avoid UI jank.
func downloadAndInstall() async {
@MainActor
func downloadAndOpenInstaller() async {
Comment thread
GordonBeeming marked this conversation as resolved.
guard let url = downloadURL else {
lastError = "No download URL available"
return
Expand Down
2 changes: 1 addition & 1 deletion Sources/Insomnia/Views/MenuBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct MenuBarView: View {
} else if updateChecker.downloadURL != nil {
// DMG available — offer direct download
Button("Download v\(version)") {
Task { await updateChecker.downloadAndInstall() }
Task { await updateChecker.downloadAndOpenInstaller() }
}
} else {
// Update exists but no DMG asset — show version info only
Expand Down
Loading