Skip to content

ci(release): stop and restart the daemon around cask upgrades - #612

Merged
zzet merged 1 commit into
zzet:mainfrom
madeinoz67:feat/cask-daemon-restart-hooks
Aug 20, 2026
Merged

ci(release): stop and restart the daemon around cask upgrades#612
zzet merged 1 commit into
zzet:mainfrom
madeinoz67:feat/cask-daemon-restart-hooks

Conversation

@madeinoz67

Copy link
Copy Markdown
Contributor

Summary

brew upgrade gortex replaces the binary while a running daemon keeps executing the old image — nothing restarts it, and nothing detects the skew (#609). PR #611 adds the detection layers; this PR closes the loop at the install path: the release pipeline's generated cask now stops a running daemon before the upgrade and restarts it onto the new binary afterwards.

Fixes the brew-upgrade leg of #609 (detection: #611).

Changes

  • .github/workflows/release.yml (the Publish homebrew cask heredoc template) gains guarded hooks in every generated Casks/gortex.rb:
    • pre_install: if a gortex binary exists AND gortex daemon status exits 0, write a tmp marker and run gortex daemon stop — releases the store lock and retires the old image before the swap.
    • post_install: if the marker exists, delete it and run gortex daemon restart (routes through the supervisor when launchd owns the daemon).
    • Fresh installs and CI never launch a daemon — both hooks no-op when no daemon was running.

Testing

  • Template rendered with dummy shas and syntax-checked (ruby -c on the produced cask: Syntax OK); workflow YAML parses.
  • New tests — N/A (a YAML heredoc template; the Ruby is validated by rendering it).
  • Runtime behavior lands at the next release cut, when the generated cask reaches zzet/homebrew-tap; a manual brew upgrade on macOS confirms then.

Notes

  • Deliberately targets the generator, not the tap file: the tap's cask is stamped out on every release and any hand edit would be overwritten.
  • daemon status as the was-running probe reuses gortex's own socket resolution (no XDG path duplication in Ruby); it is bounded by the daemon's 30s control timeout.

The generated cask gains guarded pre_install/post_install hooks: pre stops
a running daemon (only when one answers; recorded via a tmp marker) so the
binary swap and any store migration happen without a stale daemon holding
the old image and the store lock; post restarts onto the new binary only
when one was running. Fresh installs and CI never launch a daemon.

Fixes the brew-upgrade leg of zzet#609 alongside PR zzet#611's detection layers.
@zzet
zzet merged commit 8705528 into zzet:main Aug 20, 2026
10 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.

2 participants