-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Use release version and run number in app bundle #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
44d28af
feat: Use release version and run number in app bundle
GordonBeeming dfd9807
fix: Use major.minor.runNumber format (e.g., 0.2.42)
GordonBeeming 8043195
fix: Strip patch from tag in CI, pass major.minor to build script
GordonBeeming b6b4c1a
fix: Use v0.2 tag format — no patch number in tags
GordonBeeming 2cb63f4
docs: Add CLAUDE.md project conventions and create-release skill
GordonBeeming 8f0b639
fix: Address PR review feedback
GordonBeeming 998b771
fix: Stage remaining build-release.sh changes
GordonBeeming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| description: Create a new draft release for Insomnia. Use when the user says "create a release", "new release", "cut a release", or "ship it". | ||
| --- | ||
|
|
||
| # Create Release | ||
|
|
||
| Create a new GitHub release for Insomnia with the correct versioning. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Pull latest: `but pull` | ||
| 2. Determine the next version by checking existing releases: | ||
| ```bash | ||
| gh release list --repo gordonbeeming/insomnia --limit 5 | ||
| ``` | ||
| 3. Bump the minor version (e.g., v0.2 → v0.3). Never use a patch number in the tag. | ||
| 4. Create the release: | ||
| ```bash | ||
| gh release create v{major}.{minor} \ | ||
| --repo gordonbeeming/insomnia \ | ||
| --target main \ | ||
| --title "v{major}.{minor} — {short description}" \ | ||
| --notes "$(cat <<'EOF' | ||
| # Insomnia v{major}.{minor} — {short description} | ||
|
|
||
| ## What's New | ||
|
|
||
| - {list changes since last release using git log} | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| brew upgrade --cask gordonbeeming/tap/insomnia | ||
| ``` | ||
|
|
||
| Or download the DMG and CLI binary from the assets below. | ||
| EOF | ||
| )" | ||
| ``` | ||
| 5. The release pipeline will automatically: | ||
| - Build + test | ||
| - Sign with Developer ID | ||
| - Notarize with Apple | ||
| - Create DMG | ||
| - Upload assets to the release | ||
| - Update the Homebrew tap cask | ||
| 6. Report the release URL and pipeline run to the user | ||
|
|
||
| ## Version Format | ||
|
|
||
| - Tags: `v{major}.{minor}` (e.g., `v0.3`) — NO patch number | ||
| - Bundle version: `{major}.{minor}.{runNumber}` — CI adds the run number as patch | ||
| - The tag `v0.3` with run number 45 produces bundle version `0.3.45` | ||
|
|
||
| ## Generating Release Notes | ||
|
|
||
| Use git log to find changes since the last release tag: | ||
| ```bash | ||
| LAST_TAG=$(gh release list --repo gordonbeeming/insomnia --limit 1 --json tagName --jq '.[0].tagName') | ||
| git log ${LAST_TAG}..HEAD --oneline | ||
| ``` | ||
|
|
||
| ## Important | ||
|
|
||
| - Never reuse or delete existing release tags | ||
| - Always bump the minor version for new releases | ||
| - Never use `.0` patch in tags (v0.3 not v0.3.0) | ||
| - The release triggers the full CI pipeline — wait for it to complete before telling the user to `brew upgrade` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| # Insomnia | ||
|
|
||
| A macOS caffeinate utility — menu bar app + CLI. Mascot: Dapple the Mushroom. | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| - Swift (SwiftUI + AppKit hybrid) | ||
| - macOS 14+, Apple Silicon (arm64) only | ||
| - IOKit power assertions (native, no shelling out to `caffeinate`) | ||
| - Swift ArgumentParser for CLI | ||
| - XCTest for unit + integration tests | ||
|
|
||
| ## Project Structure | ||
|
|
||
| Three targets in `Package.swift`: | ||
| - `InsomniaCore` — shared library (power management, scheduling, IPC, models) | ||
| - `Insomnia` — macOS GUI app (MenuBarExtra + AppKit) | ||
| - `InsomniaCLI` — CLI tool | ||
|
|
||
| ## Build & Test | ||
|
|
||
| ```bash | ||
| swift build # debug build | ||
| swift test # 118+ tests | ||
| swift run Insomnia # run GUI locally | ||
| swift run InsomniaCLI status # run CLI | ||
| ``` | ||
|
|
||
| ## Code Comments | ||
|
|
||
| 85%+ comment coverage required. Every file needs: | ||
| - File header explaining purpose | ||
| - `///` doc comments on public APIs | ||
| - Inline comments explaining intent on significant code blocks | ||
|
|
||
| ## Versioning | ||
|
|
||
| - Tags: `v{major}.{minor}` (e.g., `v0.2`, `v0.3`) — no patch number | ||
| - Build number: GitHub Actions run number becomes the patch | ||
| - Bundle version: `{major}.{minor}.{runNumber}` (e.g., `0.2.42`) | ||
| - The `.0` patch in tags is meaningless — never use `v0.2.0` | ||
|
|
||
| ## Distribution | ||
|
|
||
| - Homebrew: `brew install --cask gordonbeeming/tap/insomnia` | ||
| - Always use fully qualified name (upstream "Insomnia" API client conflicts) | ||
| - Cask auto-updated by CI on release via deploy key | ||
| - GitHub Releases: signed + notarized DMG + CLI binary | ||
| - No App Store (IOKit needs unsandboxed access) | ||
|
|
||
| ## CI/CD | ||
|
|
||
| - `.github/workflows/build.yml` | ||
| - Push/PR: build + test only | ||
| - Release (published): build + test + sign + notarize + DMG + upload + update Homebrew tap | ||
| - Secrets: `DEVELOPER_ID_CERTIFICATE`, `DEVELOPER_ID_PASSWORD`, `APPLE_ID`, `APPLE_TEAM_ID`, `APPLE_APP_PASSWORD`, `HOMEBREW_TAP_DEPLOY_KEY` | ||
|
|
||
| ## Dev vs Prod | ||
|
|
||
| Debug builds use separate identifiers (`BuildEnvironment.swift`): | ||
| - App name: "Insomnia Dev" | ||
| - IPC socket: `~/Library/Application Support/Insomnia Dev/insomnia.sock` | ||
| - UserDefaults prefix: `com.insomnia.dev.*` | ||
| - "(Dev)" suffix in status text | ||
|
|
||
| This lets dev and prod run side-by-side. | ||
|
|
||
| ## Key Files | ||
|
|
||
| - `Sources/InsomniaCore/Power/PowerAssertionManager.swift` — IOKit assertion lifecycle | ||
| - `Sources/InsomniaCore/IPC/IPCServer.swift` — Unix domain socket server | ||
| - `Sources/InsomniaCore/Models/BuildEnvironment.swift` — dev/prod separation | ||
| - `Sources/Insomnia/InsomniaApp.swift` — @main, MenuBarExtra scene | ||
| - `Sources/Insomnia/Views/MenuBarView.swift` — main dropdown menu | ||
| - `Sources/Insomnia/AppDelegate.swift` — lifecycle, IPC server, icon loading | ||
| - `Scripts/build-release.sh` — builds CLI + .app bundle (args: version, build number) | ||
| - `Resources/AppIcon.icns` — Dapple mushroom icon | ||
|
|
||
| ## Window Focus Pattern | ||
|
|
||
| LSUIElement apps need special handling to show windows: | ||
| 1. `NSApp.setActivationPolicy(.regular)` before opening | ||
| 2. `openWindow(id:)` to open | ||
| 3. Reapply app icon via `AppDelegate.reapplyAppIcon()` | ||
| 4. `NSApp.activate(ignoringOtherApps: true)` after short delay | ||
| 5. Return to `.accessory` in `onDisappear` (unless dock icon enabled) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.