Sparkle updates !236

merged merged by cmc on 2026-10-11 06:18 UTC · krz/orgstar:sparkle-updates into main

12 files changed, +218 −30

Layout: unified · split

Package.resolved +10 −1
@@ -1,5 +1,5 @@
11{
2 "originHash" : "99f611db4aa216eecc3254d58a7ad6ee060533c7f899b1a0d0f72c21a75f90a9",
2 "originHash" : "13a9fcac60cd27fea1022731e52b785749d4a9dfb56c2e629b61c25a99e5464d",
33 "pins" : [
44 {
55 "identity" : "grdb.swift",
@@ -10,6 +10,15 @@
1010 "version" : "7.11.1"
1111 }
1212 },
13 {
14 "identity" : "sparkle",
15 "kind" : "remoteSourceControl",
16 "location" : "https://github.com/sparkle-project/Sparkle",
17 "state" : {
18 "revision" : "eef1a539a373c1f1a320624b1130fc5de7b2e100",
19 "version" : "2.10.0"
20 }
21 },
1322 {
1423 "identity" : "swift-tree-sitter",
1524 "kind" : "remoteSourceControl",
Package.swift +2 −1
@@ -25,6 +25,7 @@ let package = Package(
2525 ],
2626 dependencies: [
2727 .package(url: "https://github.com/groue/GRDB.swift", from: "7.11.1"),
28 .package(url: "https://github.com/sparkle-project/Sparkle", from: "2.7.0"),
2829 .package(url: "https://github.com/tree-sitter/swift-tree-sitter", from: "0.25.0"),
2930 .package(url: "https://github.com/tree-sitter/tree-sitter-bash", exact: "0.25.1"),
3031 .package(url: "https://github.com/tree-sitter/tree-sitter-c", exact: "0.24.2"),
@@ -82,7 +83,7 @@ let package = Package(
8283 ),
8384 .executableTarget(name: "OrgstarSpike", dependencies: ["OrgEditorAppKit"]),
8485 .target(name: "OrgApp", dependencies: ["OrgWorkspace", "OrgDocument", "OrgPresentation"]),
85 .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgEditorAppKit", "OrgHighlight"]),
86 .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgEditorAppKit", "OrgHighlight", .product(name: "Sparkle", package: "Sparkle")]),
8687 // The iOS app, bundled by scripts/build-ios-app.sh.
8788 .executableTarget(name: "OrgstarMobile", dependencies: ["OrgApp", "OrgHighlight"]),
8889 // App extensions, bundled into orgstar.app by scripts/build-app.sh.
Sources/Orgstar/OrgstarApp.swift +15 −1
@@ -162,9 +162,11 @@ struct PromptRequest: Identifiable {
162162final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate {
163163 var session: DocumentSession?
164164 var commands: AppCommands?
165 let updates = Updates()
165166
166167 func applicationDidFinishLaunching(_ notification: Notification) {
167168 if SystemReminderCenter.isAvailable { UNUserNotificationCenter.current().delegate = self }
169 updates.start()
168170 }
169171
170172 /// `:session` interpreters end with the app.
@@ -462,9 +464,12 @@ struct OrgstarApp: App {
462464 Button("Edit Config File") { commands.jump(path: UserConfig.configFile.path, offset: 0) }
463465 .keyboardShortcut(",", modifiers: [.command, .option])
464466 }
467 CommandGroup(after: .appInfo) {
468 CheckForUpdatesItem(updates: delegate.updates)
469 }
465470 }
466471 Settings {
467 SettingsView(commands: commands, workspace: try? workspace.get())
472 SettingsView(commands: commands, workspace: try? workspace.get(), updates: delegate.updates)
468473 }
469474 }
470475}
@@ -537,6 +542,7 @@ struct AgendaMenuItem: View {
537542struct SettingsView: View {
538543 let commands: AppCommands
539544 let workspace: WorkspaceModel?
545 let updates: Updates
540546 @State private var importing = false
541547 @Environment(\.openWindow) private var openWindow
542548 @AppStorage("saveMode") private var saveMode = SaveMode.automatic
@@ -612,6 +618,14 @@ struct SettingsView: View {
612618 Text("Every setting here is also in \(UserConfig.configFile.path), which you can edit, share or keep with your dotfiles. Changes in either place show up in the other.")
613619 .settingsFooter()
614620 }
621 if updates.canCheck {
622 Section {
623 Toggle("Check for updates automatically", isOn: Binding(get: { updates.automatically }, set: { updates.automatically = $0 }))
624 } footer: {
625 Text("Once a day, from the app's own feed. orgstar ▸ Check for Updates… checks now.")
626 .settingsFooter()
627 }
628 }
615629 Section {
616630 Picker("Save files", selection: $saveMode) {
617631 Text("Automatically, when typing stops").tag(SaveMode.automatic)
Sources/Orgstar/Updates.swift added +42
@@ -0,0 +1,42 @@
1import Combine
2import Sparkle
3import SwiftUI
4
5/// Sparkle, for the signed builds: the Info.plist names the appcast and the key the DMGs are
6/// signed with. A dev build has neither, so the updater doesn't start and the menu item stays
7/// disabled. Whether to check automatically is Sparkle's own setting, asked once on the
8/// second launch.
9@MainActor
10@Observable
11final class Updates {
12 private(set) var canCheck = false
13 @ObservationIgnored private var controller: SPUStandardUpdaterController?
14 @ObservationIgnored private var observation: AnyCancellable?
15
16 func start() {
17 guard controller == nil, Bundle.main.object(forInfoDictionaryKey: "SUFeedURL") != nil else { return }
18 let controller = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
19 self.controller = controller
20 observation = controller.updater.publisher(for: \.canCheckForUpdates).sink { [weak self] can in
21 MainActor.assumeIsolated { self?.canCheck = can }
22 }
23 }
24
25 func check() {
26 controller?.updater.checkForUpdates()
27 }
28
29 var automatically: Bool {
30 get { controller?.updater.automaticallyChecksForUpdates ?? false }
31 set { controller?.updater.automaticallyChecksForUpdates = newValue }
32 }
33}
34
35struct CheckForUpdatesItem: View {
36 let updates: Updates
37
38 var body: some View {
39 Button("Check for Updates…") { updates.check() }
40 .disabled(!updates.canCheck)
41 }
42}
docs/manual/appcast.xml added +7
@@ -0,0 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?>
2<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
3 <channel>
4 <title>orgstar</title>
5 <link>https://gitbay.org/krz/orgstar</link>
6 </channel>
7</rss>
docs/manual/install.org +5 −2
@@ -67,8 +67,11 @@ See [[file:guide/14-ios.org][iPhone and iPad]] for what it does.
6767
6868* Updating
6969
70orgstar doesn't update itself. With Homebrew, run =brew upgrade --cask orgstar=; otherwise
71download the new DMG and replace the app. From source, pull and build again:
70orgstar checks for a new release once a day, after asking on its second launch whether it
71may; orgstar ▸ Check for Updates… checks now, and Settings ▸ General has the switch. An update
72downloads, is checked against the key the releases are signed with, and installs when you
73agree. With Homebrew, =brew upgrade --cask orgstar= works too; the cask leaves updating to the
74app otherwise. From source, pull and build again (a build without a Developer ID never checks):
7275
7376#+BEGIN_SRC sh
7477git pull
docs/plans/2026-10-10-sparkle-updates.md +28 −21
@@ -43,7 +43,7 @@
4343- Modify: `Package.swift` (dependencies; `Orgstar` target)
4444- Modify: `scripts/build-app.sh`
4545
46- [ ] Add the dependency and the product to the app target:
46- [x] Add the dependency and the product to the app target:
4747
4848```swift
4949.package(url: "https://github.com/sparkle-project/Sparkle", from: "2.7.0"),
@@ -51,7 +51,7 @@
5151.executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgEditorAppKit", "OrgHighlight", .product(name: "Sparkle", package: "Sparkle")]),
5252```
5353
54- [ ] In `build-app.sh`, after copying the binary: copy the framework from the SwiftPM artifact and give the executable an rpath to it.
54- [x] In `build-app.sh`, after copying the binary: copy the framework from the SwiftPM artifact and give the executable an rpath to it.
5555
5656```sh
5757sparkle="$(find .build/artifacts -path '*Sparkle.xcframework/macos-*/Sparkle.framework' -maxdepth 6 | head -1)"
@@ -61,7 +61,7 @@ ditto "$sparkle" "$app/Contents/Frameworks/Sparkle.framework"
6161install_name_tool -add_rpath @executable_path/../Frameworks "$app/Contents/MacOS/Orgstar"
6262```
6363
64- [ ] Sign Sparkle's inner pieces before the app, with the same identity and flags (Sparkle's documented order), inside the final signing block:
64- [x] Sign Sparkle's inner pieces before the app, with the same identity and flags (Sparkle's documented order), inside the final signing block:
6565
6666```sh
6767fw="$app/Contents/Frameworks/Sparkle.framework/Versions/B"
@@ -70,7 +70,7 @@ for item in "$fw/XPCServices/Installer.xpc" "$fw/XPCServices/Downloader.xpc" "$f
7070done
7171```
7272
73- [ ] Add `SUFeedURL` and `SUPublicEDKey` to the generated Info.plist only when `sign` is not `-`:
73- [x] Add `SUFeedURL` and `SUPublicEDKey` to the generated Info.plist only when `sign` is not `-`:
7474
7575```sh
7676if [ "$sign" != "-" ]; then
@@ -82,8 +82,8 @@ fi
8282
8383and `${feed_keys}` in the plist heredoc after `LSMinimumSystemVersion`. The public key is pasted into `scripts/release-mac.sh` as a default for `ORGSTAR_ED_PUBLIC_KEY` once Task 3 generates it.
8484
85- [ ] Verify: `sh scripts/build-app.sh`, then `otool -l .build/app/orgstar.app/Contents/MacOS/Orgstar | grep -A2 LC_RPATH` shows the Frameworks rpath, `open .build/app/orgstar.app` launches, and `codesign --verify --strict --deep .build/app/orgstar.app` passes.
86- [ ] Commit "Link Sparkle and bundle its framework".
85- [x] Verify: `sh scripts/build-app.sh`, then `otool -l .build/app/orgstar.app/Contents/MacOS/Orgstar | grep -A2 LC_RPATH` shows the Frameworks rpath, `open .build/app/orgstar.app` launches, and `codesign --verify --strict --deep .build/app/orgstar.app` passes.
86- [x] Commit "Link Sparkle and bundle its framework".
8787
8888### Task 2: Check for Updates… and the setting
8989
@@ -91,7 +91,7 @@ and `${feed_keys}` in the plist heredoc after `LSMinimumSystemVersion`. The publ
9191- Modify: `Sources/Orgstar/OrgstarApp.swift` (`AppDelegate` at line 151; `.commands`)
9292- Modify: `Sources/Orgstar/OrgstarApp.swift` (`SettingsView`, the General tab at line 551)
9393
94- [ ] In the app delegate, one controller for the process:
94- [x] In the app delegate, one controller for the process:
9595
9696```swift
9797import Sparkle
@@ -100,7 +100,7 @@ let updater = SPUStandardUpdaterController(startingUpdater: true, updaterDelegat
100100
101101Without a feed URL (dev builds) the updater logs that it can't start and `canCheckForUpdates` stays false; that is the intended dev behaviour.
102102
103- [ ] Menu item after About, following Sparkle's SwiftUI sample:
103- [x] Menu item after About, following Sparkle's SwiftUI sample:
104104
105105```swift
106106CommandGroup(after: .appInfo) {
@@ -111,9 +111,9 @@ CommandGroup(after: .appInfo) {
111111
112112`canCheckForUpdates` is KVO-observable; wrap the updater in a small `@Observable` holder that observes it, so the button enables once the updater starts.
113113
114- [ ] Settings ▸ General: a toggle bound to `updater.automaticallyChecksForUpdates`, shown only when `canCheckForUpdates` is true, labelled "Check for updates automatically".
115- [ ] Test by hand: a dev build shows the item disabled and no toggle; a `ORGSTAR_SIGN=<Developer ID>` build with a local feed (Task 4) shows both.
116- [ ] Commit "Check for Updates… and automatic checks".
114- [x] Settings ▸ General: a toggle bound to `updater.automaticallyChecksForUpdates`, shown only when `canCheckForUpdates` is true, labelled "Check for updates automatically".
115- [x] Test by hand: a dev build shows the item disabled and no toggle; a `ORGSTAR_SIGN=<Developer ID>` build with a local feed (Task 4) shows both.
116- [x] Commit "Check for Updates… and automatic checks".
117117
118118### Task 3: Keys and the appcast file
119119
@@ -122,8 +122,8 @@ CommandGroup(after: .appInfo) {
122122- Create: `scripts/appcast-add.sh`
123123- Modify: `docs/manual/orgo.toml` only if orgo needs the file listed to copy it (check with `scripts/publish-docs.sh --dry-run` and `ls` of the built site; `favicon.svg` and `style.css` are copied today, so it should not)
124124
125- [ ] Generate the key pair once on the release Mac: `"$(find .build/artifacts -name generate_keys -type f | head -1)"`. The private key goes to the login keychain; paste the printed public key as the `ORGSTAR_ED_PUBLIC_KEY` default in `release-mac.sh`.
126- [ ] The empty appcast:
125- [x] Generate the key pair once on the release Mac (done 2026-10-11; the public key is `release-mac.sh`'s default): `"$(find .build/artifacts -name generate_keys -type f | head -1)"`. The private key goes to the login keychain; paste the printed public key as the `ORGSTAR_ED_PUBLIC_KEY` default in `release-mac.sh`.
126- [x] The empty appcast:
127127
128128```xml
129129<?xml version="1.0" encoding="utf-8"?>
@@ -135,7 +135,7 @@ CommandGroup(after: .appInfo) {
135135</rss>
136136```
137137
138- [ ] `scripts/appcast-add.sh <appcast> <version> <build> <dmg> <notes-file>`: runs `sign_update "$dmg"` (found under `.build/artifacts` like `generate_keys`), which prints `sparkle:edSignature="…" length="…"`, and inserts after `<link>…</link>` in the channel:
138- [x] `scripts/appcast-add.sh <appcast> <version> <build> <dmg> <notes-file>`: runs `sign_update "$dmg"` (found under `.build/artifacts` like `generate_keys`), which prints `sparkle:edSignature="…" length="…"`, and inserts after `<link>…</link>` in the channel:
139139
140140```xml
141141 <item>
@@ -152,8 +152,8 @@ CommandGroup(after: .appInfo) {
152152
153153Insertion is a `sed`/`awk` on the first `</link>` after `<channel>`; the script refuses a version already present (`grep -q "<sparkle:shortVersionString>$version<"`) and ends with `xmllint --noout "$appcast"`.
154154
155- [ ] Verify with a throwaway copy: `scripts/appcast-add.sh /tmp/a.xml 0.2.0 365 .build/release/orgstar-0.2.0.dmg notes.txt` twice; the second run exits non-zero naming the version.
156- [ ] Commit "Appcast file and appcast-add.sh".
155- [x] Verify with a throwaway copy: `scripts/appcast-add.sh /tmp/a.xml 0.2.0 365 .build/release/orgstar-0.2.0.dmg notes.txt` twice; the second run exits non-zero naming the version.
156- [x] Commit "Appcast file and appcast-add.sh".
157157
158158### Task 4: Release script and cask
159159
@@ -161,7 +161,7 @@ Insertion is a `sed`/`awk` on the first `</link>` after `<channel>`; the script
161161- Modify: `scripts/release-mac.sh`
162162- Modify: `packaging/orgstar.rb`
163163
164- [ ] After `gitbay release asset add` and before the tap section, add the appcast entry through a merge request, mirroring the tap block:
164- [x] After `gitbay release asset add` and before the tap section, add the appcast entry through a merge request, mirroring the tap block:
165165
166166```sh
167167notes="Universal (Apple silicon and Intel), macOS 26 or later. Notarized."
@@ -180,7 +180,14 @@ sh scripts/publish-docs.sh
180180
181181`$notes` replaces the literal string already passed to `gitbay release create`. With `ORGSTAR_PUBLISH=0` the script runs `appcast-add.sh` on a copy under `$out` and prints the entry instead, so a dry run shows the signature.
182182
183- [ ] Cask: add `auto_updates true` after `desc`, so `brew upgrade` leaves updating to the app.
184- [ ] End-to-end check before the first real release: build with a Developer ID, point a running copy at a local appcast with `defaults write sh.krz.orgstar SUFeedURL file:///tmp/a.xml` (Sparkle reads the feed from user defaults ahead of Info.plist), Check for Updates… offers the entry and installs the DMG; then `defaults delete sh.krz.orgstar SUFeedURL`.
185- [ ] Manual: `docs/manual/guide/01-files-and-folders.org` or `install.org` gets a paragraph on updates (menu item, the setting, that the cask has `auto_updates`).
186- [ ] Commit "Release script writes the appcast; cask auto_updates".
183- [x] Cask: add `auto_updates true` after `desc`, so `brew upgrade` leaves updating to the app.
184- [ ] End-to-end check before the first real release (needs a Developer ID build and the key): build with a Developer ID, point a running copy at a local appcast with `defaults write sh.krz.orgstar SUFeedURL file:///tmp/a.xml` (Sparkle reads the feed from user defaults ahead of Info.plist), Check for Updates… offers the entry and installs the DMG; then `defaults delete sh.krz.orgstar SUFeedURL`.
185- [x] Manual: `docs/manual/guide/01-files-and-folders.org` or `install.org` gets a paragraph on updates (menu item, the setting, that the cask has `auto_updates`).
186- [x] Commit "Release script writes the appcast; cask auto_updates".
187
188## As built
189
190- Sparkle 2.10 from its SwiftPM package. `scripts/build-app.sh` copies the framework into `Contents/Frameworks`, adds the rpath, and for signed builds writes `SUFeedURL` and `SUPublicEDKey` (from `ORGSTAR_ED_PUBLIC_KEY`) into the Info.plist; a dev build has neither, so `Updates.start()` doesn't start the updater and Check for Updates… stays disabled.
191- `Sources/Orgstar/Updates.swift` holds the `SPUStandardUpdaterController`, `canCheck` through Sparkle's KVO publisher, and the automatic-checks setting, shown in Settings ▸ General only when the updater runs.
192- `scripts/appcast-add.sh` signs the DMG with `sign_update` and prepends the item; `SIGN_UPDATE` names another signer for a dry run. `scripts/release-mac.sh` runs it on a copy with `ORGSTAR_PUBLISH=0`, and for real after the DMG upload, through a merge request, then publishes the manual, which carries `docs/manual/appcast.xml`.
193- Checked: the dev bundle launches with the framework and passes `codesign --verify --strict --deep`; the appcast script with a stub signer, twice (the second run refuses the version); `release-mac.sh` parses. With the key generated: a Developer ID build carries `SUFeedURL` and `SUPublicEDKey`, verifies strictly with Sparkle signed inside it, and `sign_update` signs a DMG from the keychain, `--verify` accepts the signature, and `appcast-add.sh` writes the real entry. Not checked: the update dialog itself, which needs a second build to offer.
ios/Orgstar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +10 −1
@@ -1,5 +1,5 @@
11{
2 "originHash" : "7d490d34f6af67a62b54f98eb646b0c3d836db8f93b6fe4eda66d23de815ac9a",
2 "originHash" : "faf3117d61917429ae3562b475b907afbc566de310f2387d647ab52c2d5e8468",
33 "pins" : [
44 {
55 "identity" : "grdb.swift",
@@ -10,6 +10,15 @@
1010 "version" : "7.11.1"
1111 }
1212 },
13 {
14 "identity" : "sparkle",
15 "kind" : "remoteSourceControl",
16 "location" : "https://github.com/sparkle-project/Sparkle",
17 "state" : {
18 "revision" : "eef1a539a373c1f1a320624b1130fc5de7b2e100",
19 "version" : "2.10.0"
20 }
21 },
1322 {
1423 "identity" : "swift-tree-sitter",
1524 "kind" : "remoteSourceControl",
packaging/orgstar.rb +1
@@ -9,6 +9,7 @@ cask "orgstar" do
99 url "https://gitbay.org/krz/orgstar/releases/download/v#{version}/orgstar-#{version}.dmg"
1010 name "orgstar"
1111 desc "Native org-mode editor and agenda"
12 auto_updates true
1213 homepage "https://gitbay.org/krz/orgstar"
1314
1415 depends_on macos: :tahoe
scripts/appcast-add.sh added +40
@@ -0,0 +1,40 @@
1#!/bin/sh
2# Adds a release to the Sparkle appcast, newest first: signs the DMG with the EdDSA key in the
3# keychain (sign_update, from the Sparkle package in .build/artifacts) and writes the item.
4# Usage: scripts/appcast-add.sh <appcast.xml> <version> <build> <dmg> <notes-file>
5set -eu
6
7appcast="${1:?usage: appcast-add.sh <appcast.xml> <version> <build> <dmg> <notes-file>}"
8version="${2:?version}"
9build="${3:?build}"
10dmg="${4:?dmg}"
11notes="${5:?notes-file}"
12cd "$(dirname "$0")/.."
13
14! grep -q "<sparkle:shortVersionString>$version<" "$appcast" || { echo "$appcast already has $version." >&2; exit 1; }
15# SIGN_UPDATE names another signer, for a dry run without the key.
16sign_update="${SIGN_UPDATE:-$(find .build/artifacts -path '*/Sparkle/bin/sign_update' | head -1)}"
17[ -n "$sign_update" ] || { echo "sign_update not in .build/artifacts; swift build fetches Sparkle." >&2; exit 1; }
18signature="$("$sign_update" "$dmg")" # sparkle:edSignature="..." length="..."
19date="$(LC_ALL=C date -R)"
20name="$(basename "$dmg")"
21
22item="$(mktemp)"
23{
24 echo " <item>"
25 echo " <title>orgstar $version</title>"
26 echo " <link>https://gitbay.org/krz/orgstar/releases/tag/v$version</link>"
27 echo " <sparkle:version>$build</sparkle:version>"
28 echo " <sparkle:shortVersionString>$version</sparkle:shortVersionString>"
29 echo " <sparkle:minimumSystemVersion>26.0</sparkle:minimumSystemVersion>"
30 echo " <pubDate>$date</pubDate>"
31 echo " <description><![CDATA[$(cat "$notes")]]></description>"
32 echo " <enclosure url=\"https://gitbay.org/krz/orgstar/releases/download/v$version/$name\" type=\"application/octet-stream\" $signature/>"
33 echo " </item>"
34} > "$item"
35# After the channel's <link>, so the newest release comes first.
36awk -v item="$item" 'BEGIN { done = 0 } { print } /<\/link>/ && !done { while ((getline line < item) > 0) print line; done = 1 }' "$appcast" > "$appcast.new"
37mv "$appcast.new" "$appcast"
38rm -f "$item"
39xmllint --noout "$appcast"
40echo "$appcast: added $version"
scripts/build-app.sh +26 −1
@@ -30,8 +30,25 @@ swift build -c release $arch_flags --product OrgstarSpotlight
3030binary="$(swift build -c release $arch_flags --show-bin-path)/Orgstar"
3131
3232rm -rf "$app"
33mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
33mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" "$app/Contents/Frameworks"
3434cp "$binary" "$app/Contents/MacOS/Orgstar"
35
36# Sparkle, from its SwiftPM artifact: the framework beside the binary, found through an rpath.
37sparkle="$(find .build/artifacts -path '*Sparkle.xcframework/macos-*/Sparkle.framework' -maxdepth 7 | head -1)"
38[ -n "$sparkle" ] || { echo "Sparkle.framework not in .build/artifacts; swift build fetches it." >&2; exit 1; }
39ditto "$sparkle" "$app/Contents/Frameworks/Sparkle.framework"
40otool -l "$app/Contents/MacOS/Orgstar" | grep -q '@executable_path/../Frameworks' \
41 || install_name_tool -add_rpath @executable_path/../Frameworks "$app/Contents/MacOS/Orgstar"
42
43# Updates: the appcast and its signing key, for signed builds only; a dev build never checks.
44if [ "$sign" != "-" ]; then
45 feed_keys=" <key>SUFeedURL</key>
46 <string>https://krz.gitbay.site/orgstar/appcast.xml</string>
47 <key>SUPublicEDKey</key>
48 <string>${ORGSTAR_ED_PUBLIC_KEY:?set ORGSTAR_ED_PUBLIC_KEY to the key generate_keys printed}</string>"
49else
50 feed_keys=""
51fi
3552iconset="$(mktemp -d)/AppIcon.iconset"
3653swift scripts/make-icon.swift "$iconset"
3754iconutil -c icns "$iconset" -o "$app/Contents/Resources/AppIcon.icns"
@@ -108,6 +125,7 @@ cat > "$app/Contents/Info.plist" <<EOF
108125 <string>${build}</string>
109126 <key>LSMinimumSystemVersion</key>
110127 <string>26.0</string>
128${feed_keys}
111129 <key>LSApplicationCategoryType</key>
112130 <string>public.app-category.productivity</string>
113131 <key>NSCalendarsFullAccessUsageDescription</key>
@@ -188,6 +206,13 @@ appex OrgstarQuickLook com.apple.quicklook.preview PreviewProvider \
188206appex OrgstarSpotlight com.apple.spotlight.import ImportExtension \
189207 "<key>CSSupportedContentTypes</key><array><string>org.orgmode.org</string></array>"
190208
209# Sparkle's inner pieces are signed first, as its documentation has it, then the framework.
210fw="$app/Contents/Frameworks/Sparkle.framework/Versions/B"
211for item in "$fw/XPCServices/Installer.xpc" "$fw/XPCServices/Downloader.xpc" "$fw/Autoupdate" "$fw/Updater.app" "$app/Contents/Frameworks/Sparkle.framework"; do
212 # shellcheck disable=SC2086
213 codesign --force --sign "$sign" $sign_flags "$item"
214done
215
191216# The hardened runtime needs Calendar access declared for the agenda's events.
192217cat > "$work/app.entitlements" <<PLIST
193218<?xml version="1.0" encoding="UTF-8"?>
scripts/release-mac.sh +32 −2
@@ -6,6 +6,11 @@
66# ORGSTAR_NOTARY notarytool keychain profile (default: orgstar)
77# ORGSTAR_TAP the homebrew-tap checkout (default: ../homebrew-tap)
88# ORGSTAR_PUBLISH 0 builds and notarizes without tagging, uploading or touching the tap
9# ORGSTAR_ED_PUBLIC_KEY the Sparkle public key (default: the one whose private half is in the
10# release Mac's login keychain, from generate_keys); passed on to build-app.sh
11#
12# Updates: after the DMG is uploaded, the release goes into docs/manual/appcast.xml through a
13# merge request on main, and the manual is published, which serves the appcast.
914set -eu
1015
1116cd "$(dirname "$0")/.."
@@ -16,6 +21,9 @@ tap="${ORGSTAR_TAP:-../homebrew-tap}"
1621publish="${ORGSTAR_PUBLISH:-1}"
1722sign="${ORGSTAR_SIGN:-$(security find-identity -v -p codesigning | sed -n 's/.*"\(Developer ID Application: .*\)"/\1/p' | head -1)}"
1823[ -n "$sign" ] || { echo "No Developer ID Application identity in the keychain." >&2; exit 1; }
24# The Sparkle public key; its private half is in the release Mac's login keychain (generate_keys).
25export ORGSTAR_ED_PUBLIC_KEY="${ORGSTAR_ED_PUBLIC_KEY:-StvsRDaDoGd4S/G66l7XHAcd3KPlpJlu0Gsv9GemsSo=}"
26notes="Universal (Apple silicon and Intel), macOS 26 or later. Notarized."
1927
2028if [ "$publish" != 0 ]; then
2129 [ -z "$(git status --porcelain)" ] || { echo "The working tree has changes." >&2; exit 1; }
@@ -44,14 +52,36 @@ xcrun stapler staple "$app"
4452spctl --assess --type open --context context:primary-signature -v "$dmg"
4553sha="$(shasum -a 256 "$dmg" | cut -d' ' -f1)"
4654echo "$dmg $sha"
55printf '%s\n' "$notes" > "$out/notes.txt"
4756
48[ "$publish" != 0 ] || exit 0
57if [ "$publish" = 0 ]; then
58 # The appcast entry on a copy, so a dry run shows the signature.
59 cp docs/manual/appcast.xml "$out/appcast.xml"
60 sh scripts/appcast-add.sh "$out/appcast.xml" "$version" "$build" "$dmg" "$out/notes.txt"
61 exit 0
62fi
4963
5064git tag -s "$tag" -m "orgstar $version"
5165git push origin "$tag"
52gitbay release create krz/orgstar "$tag" --title "orgstar $version" --notes "Universal (Apple silicon and Intel), macOS 26 or later. Notarized."
66gitbay release create krz/orgstar "$tag" --title "orgstar $version" --notes "$notes"
5367gitbay release asset add krz/orgstar "$tag" "orgstar-$version.dmg" < "$dmg"
5468
69# The appcast goes in through a merge request, as every change to main does, after the DMG
70# it points at is up; then the manual, which serves it, is published.
71branch="appcast-$version"
72git switch -q -c "$branch"
73sh scripts/appcast-add.sh docs/manual/appcast.xml "$version" "$build" "$dmg" "$out/notes.txt"
74git add docs/manual/appcast.xml
75git commit -q -m "Appcast for $version"
76git push -q -u origin "$branch"
77mr="$(gitbay mr create --source "$branch" --target main --title "Appcast for $version" --body "Sparkle entry for orgstar $version." --json | sed -n 's/.*"number":\([0-9]*\).*/\1/p')"
78gitbay mr merge "$mr" --strategy ff
79git switch -q main
80git pull -q --ff-only
81git branch -d "$branch"
82git push -q origin --delete "$branch"
83sh scripts/publish-docs.sh
84
5585# The cask goes in through a merge request, as every change to the tap's main does.
5686branch="orgstar-$version"
5787git -C "$tap" switch -q main