Skip to content

feat(updates): add in-app updates with Sparkle - #14

Merged
DerRafDev merged 4 commits into
mainfrom
feat/sparkle-updater
Nov 7, 2026
Merged

DerRafDev merged 4 commits into
mainfrom
feat/sparkle-updater

Conversation

@DerRafDev

@DerRafDev DerRafDev commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

What

In-app updates with Sparkle 2: gear menu › Check for Updates… (Buscar atualizações… in pt-BR) runs a user-initiated check with Sparkle's standard dialogs: release notes, download, Install and Relaunch. There are no background checks. The release workflow also gets a manual dry run that builds the release and uploads dist/ as an Actions artifact, without a tag or a release.

Draft until the release signing key exists. SPARKLE_PUBLIC_ED_KEY in apps/macos/Config/TokenBar.xcconfig is still empty, and scripts/release.sh refuses to build while it is. The maintainer adds the public key to this branch and the SPARKLE_PRIVATE_KEY secret to the repository.

Why

TokenBar had no way to update: every version had to be downloaded and approved by hand. Sparkle is the standard, audited framework for this on macOS. It is the project's first third-party dependency; docs/architecture.md › Dependencies explains its boundary: app target only, and TokenBarKit sees only an UpdateChecking protocol. There is no issue for it; the scope was agreed directly with the maintainer.

What changed

App

  • Sparkle 2.10.1 via SwiftPM, app target only (Package.resolved committed).
  • SoftwareUpdater (app target) wraps SPUStandardUpdaterController. UpdateChecking lives in TokenBarUI, and the popover adds the menu item (disabled while a check runs) plus its pt-BR string.
  • Config/Info.plist is merged into the generated plist: SUFeedURL, SUPublicEDKey, SUEnableAutomaticChecks = NO, SUVerifyUpdateBeforeExtraction = YES.
  • The feed is https://github.com/DerRafDev/tokenbar/releases/latest/download/appcast.xml, i.e. the appcast.xml of the latest published release. Drafts and pre-releases are never offered.

Build settings, found while testing real release builds

  • LD_RUNPATH_SEARCH_PATHS: without it the app crashed at launch, because it could not find Sparkle.framework. CI only builds, so it would not have caught this.
  • Ad-hoc builds (Debug, and unsigned releases like 0.1.0) need com.apple.security.cs.disable-library-validation. Without it the hardened runtime refuses Sparkle, since there is no Team ID to match. The new TokenBar-AdHoc.entitlements is applied by release.sh only when there is no Developer ID. Developer ID builds do not get it.
  • COPY_PHASE_STRIP = NO removes a new "not stripping binary because it is signed" warning for Sparkle.

Release pipeline

  • scripts/release.sh:
    • re-signs Sparkle's helpers, framework and app, innermost first, with the release identity and the hardened runtime;
    • EdDSA-signs the zip and writes dist/appcast.xml (with scripts/appcast.sh);
    • checks the signature against the SUPublicEDKey inside the built app, and stops if they are not a pair.
  • .github/workflows/release.yml is split into two jobs:
    • build (read-only token, holds the signing secrets) uploads dist/ as an artifact;
    • draft-release (tag push only, contents: write) creates the draft from that same artifact.
    • workflow_dispatch runs only build. The tag/version check is tag-only. SPARKLE_PRIVATE_KEY is required.
  • scripts/test-update.sh: local end-to-end test with two real release builds, a throwaway key, a separate bundle ID and a 127.0.0.1 feed (update, none, bad-signature).

Docs: README (Updating, plus the one-time manual install for 0.1.0 users, privacy, features), releasing.md (Sparkle, key setup, dry run, checking the zip and appcast, reviewing the draft, local test), release-checklist.md, architecture.md, roadmap.md.

How it was tested

Locally on macOS 27 / Xcode 27:

  • scripts/lint.sh and scripts/test.sh (58 tests) pass.
  • Debug and Release builds succeed. The only remaining warnings are NSAppleEventsUsageDescription (Release) and the AppIntents metadata notice, which both exist on main too.
  • actionlint 1.7.12 passes on every workflow.
  • End-to-end with scripts/test-update.sh: real release.sh builds, ad-hoc signed, clicked through the real menu.
    • Update: 0.90.0 → gear › Buscar atualizações… → Install → Install and Relaunch. The app reopened as 0.91.0 (build 9001) with a valid signature and the test preferences kept (menuBarDisplay, refreshInterval). Done twice.
    • No update: "O app está atualizado!" (the Sparkle dialogs are in pt-BR on a pt-BR system).
    • Bad signature: the zip was downloaded, then refused; 0.90.0 stayed installed and running.
  • CI key path: release.sh with the key passed through SPARKLE_PRIVATE_KEY, as the workflow does. The documented checks all pass on its output:
    • checksums and xmllint;
    • version, URL and length in the appcast;
    • sign_update --verify;
    • SUPublicEDKey and SUFeedURL inside the zip's app;
    • codesign --verify --deep --strict.

Still to validate in Actions

These cannot run before the key exists and this PR is merged (workflow_dispatch only works once the workflow is on the default branch).

  • CI on this PR: Lint, Build & Test, PR Title.
  • The maintainer adds SPARKLE_PUBLIC_ED_KEY to this branch and the SPARKLE_PRIVATE_KEY secret to the repository.
  • After merge: a dry run on main (Actions › Release › Run workflow). Download the artifact and check it as in docs/releasing.md › Dry run. This is the first time the private key is used from the secret and upload-artifact@v7 runs.
  • First tag: draft-release downloads the artifact (download-artifact@v8) and creates the draft. Review it as in releasing.md › Reviewing the draft.
  • With Developer ID and notary secrets (not configured yet): the Sparkle re-sign under Developer ID plus notarization. This path is untested without a certificate.

Nothing in this PR creates a tag, publishes a release or changes the public feed. Until the first release with the updater is published, Check for Updates… shows an error, because 0.1.0 has no appcast.xml.

Checklist

  • scripts/lint.sh and scripts/test.sh pass locally
  • No tokens, cookies, account IDs, or real responses in code, fixtures, or logs (test keys are generated at run time in build/, which is ignored)
  • Docs updated if behavior or architecture changed

🤖 Generated with Claude Code

DerRafDev and others added 4 commits November 6, 2026 18:36
Gear menu > Check for Updates… (Buscar atualizações… in pt-BR) runs a
user-initiated Sparkle check with the framework's standard dialogs:
release notes, download, Install and Relaunch. No background checks.

- Sparkle 2.10.1 via SwiftPM, app target only; TokenBarKit sees only
  the UpdateChecking protocol.
- Feed: appcast.xml attached to the latest published GitHub Release,
  so drafts and pre-releases are never offered.
- release.sh re-signs Sparkle's helpers, EdDSA-signs the zip, checks
  the signature against the app's SUPublicEDKey and writes
  dist/appcast.xml (scripts/appcast.sh). It refuses to run while
  SPARKLE_PUBLIC_ED_KEY is empty; the workflow requires the
  SPARKLE_PRIVATE_KEY secret.
- Embedding a framework needed LD_RUNPATH_SEARCH_PATHS, and ad-hoc
  builds (Debug, unsigned releases) need disable-library-validation
  to load Sparkle under the hardened runtime. Developer ID builds do
  not get that entitlement.
- scripts/test-update.sh: local end-to-end test with two release
  builds, a throwaway key and a 127.0.0.1 feed (update, none,
  bad-signature).
- Docs: README Updating section (0.1.0 users install once by hand),
  privacy, releasing guide, checklist, architecture, roadmap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Running the Release workflow by hand (workflow_dispatch) runs the same
build job as a tag push, with the same scripts/release.sh and secrets,
and ends after uploading dist/ (signed zip, dmg, appcast.xml,
SHA256SUMS.txt) as an Actions artifact. No tag, no release, no change
to the update feed.

The workflow is split in two jobs:
- build: read-only token, holds the signing secrets, uploads dist/.
- draft-release: tag pushes only, contents: write, creates the draft
  from that same artifact.

The tag check runs only on tag pushes. docs/releasing.md explains that
the trigger must be on the default branch before it can be run, and
how to download and verify the artifact; the release checklist asks
for a reviewed dry run before tagging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sparkle ships signed, so Xcode cannot strip it and warned on every
build. No other binary goes through a copy phase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README: where Check for Updates… is (gear menu, above Quit), the
  Sparkle button names in both languages, that no release has the
  updater yet, and step-by-step manual install for 0.1.0 users.
- releasing.md: numbered flow (local test → dry run → checks → tag →
  draft review → publish), the two workflow jobs, a new "Reviewing the
  draft" section, merge and dry run as prerequisites for the first
  updater release; drop machine-specific wording.
- release-checklist.md: check the draft's appcast.xml; unsigned names.
- architecture.md, roadmap.md: Sparkle in the app target; in-app
  updates listed as planned for the first release after 0.1.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DerRafDev
DerRafDev marked this pull request as ready for review November 7, 2026 03:50
@DerRafDev
DerRafDev merged commit 2751b99 into main Nov 7, 2026
4 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