Skip to content

feature: sparkle ota updates published from ci - #5

Merged
mgruszkiewicz merged 3 commits into
mainfrom
feature/sparkle-ota-updates
Aug 2, 2026
Merged

mgruszkiewicz merged 3 commits into
mainfrom
feature/sparkle-ota-updates

Conversation

@mgruszkiewicz

Copy link
Copy Markdown
Owner

Sets up Sparkle for over-the-air updates and automates publishing from a tag push.

The bug this started from

Sparkle was present in the project as an XCRemoteSwiftPackageReference but was never linked to the app target — packageProductDependencies and the frameworks build phase were both empty. Nothing would have loaded at runtime.

Two Info.plist keys also had to go. SUEnableDownloaderService and SUEnableInstallerLauncherService are sandbox-only, and Palium is not sandboxed — they would have routed updates through XPC services for no reason.

App

  • Link Sparkle to the palium target; Sparkle.framework, Autoupdate and Updater.app now land in the bundle
  • UpdaterService owns the SPUStandardUpdaterController, matching the existing @MainActor @Observable singleton style
  • Check for Updates… in the app menu, plus a Settings ▸ Updates tab
  • Background check once a day

Releasing

git tag v1.1.0 && git push origin v1.1.0 is the whole flow.

  • Binaries become GitHub Release assets; appcast.xml and rendered release notes go to gh-pages
  • The release is created before the appcast, so the feed never points at a missing asset
  • The built Info.plist is asserted against the tag before signing — a mismatch fails the run instead of shipping a bad appcast
  • Version comes from the tag, build number from the commit count, so Sparkle's ordering key only ever increases
  • scripts/appcast.py edits a single <item> into the published feed; Sparkle's own generate_appcast wants every archive ever shipped on disk, which CI does not have
  • zip-app uses ditto — plain zip mangles the symlinks in Sparkle.framework and invalidates the code signature

The EdDSA key is read from the SPARKLE_PRIVATE_KEY secret over stdin and never touches the runner's disk. Note sign_update -s <key> was removed in 2.9.4, which most guides still recommend.

Sparkle is pinned to the exact revision in Package.resolved via -onlyUsePackageVersionsFromResolvedFile, so a release ships the version that was tested.

Verified locally

Real build → ditto zip → sign_update → --verify passes → appcast generated → unzip round-trip preserves the code signature and framework. App launches with Sparkle loaded under hardened runtime + ad-hoc signing. make test passes.

Before merging — three manual steps

  1. Add repository secret SPARKLE_PRIVATE_KEY (export with generate_keys -x). Back it up; losing it means existing installs can never be updated, since they only trust the SUPublicEDKey already in their bundle.
  2. Settings ▸ Actions ▸ Workflow permissions must be Read and write.
  3. Enable Pages on gh-pages after the first release — that run creates the branch. Until Pages is live the appcast 404s and the app reports no updates; harmless, but do not read it as a broken updater.

Palium still ships ad-hoc signed and un-notarized. Sparkle is fine with this (the EdDSA signature alone establishes trust), but first-time users must right-click ▸ Open. docs/RELEASING.md covers the Developer ID upgrade path, which changes nothing about the appcast or the key.

Sparkle was referenced as a package but never linked to the app target, so
updates could not have worked. Link it, wire up the updater, and automate
publishing from a tag push.

App:
- link Sparkle to the palium target and add UpdaterService owning the
  SPUStandardUpdaterController
- expose "Check for Updates..." in the app menu and an Updates settings tab
- drop SUEnableDownloaderService / SUEnableInstallerLauncherService from
  Info.plist; both are sandbox-only and palium is not sandboxed
- check for updates daily in the background

Release:
- release.yml builds, EdDSA-signs and publishes on a v* tag; binaries go to
  the GitHub release, appcast.xml and release notes to gh-pages
- the release is created before the appcast so the feed never points at a
  missing asset, and the built Info.plist is asserted against the tag
- version comes from the tag, build number from the commit count so Sparkle's
  ordering key only ever increases
- scripts/appcast.py edits a single item into the published appcast, since
  generate_appcast needs every archive ever shipped on disk
- zip-app uses ditto; plain zip mangles the symlinks in Sparkle.framework and
  invalidates the code signature

The signing key is read from the SPARKLE_PRIVATE_KEY secret over stdin and
never touches the runner's disk. See docs/RELEASING.md for the one-time setup.
Package.resolved was ignored, so a release could silently build against any
2.x Sparkle the upToNextMajorVersion requirement allowed rather than the one
that was tested. For the one dependency that installs code on users' machines
that is worth pinning.

- track project.xcworkspace so Package.resolved is versioned; a !negation
  cannot work here because git will not re-include a file whose parent
  directory is excluded. xcuserdata/ still covers the per-user noise.
- pass -onlyUsePackageVersionsFromResolvedFile on archive and build-unsigned
  so the pin is enforced rather than advisory
@mgruszkiewicz
mgruszkiewicz merged commit ed3c0a9 into main Aug 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant