Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/project-and-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ paths:

- `project.yml` is the source of truth for build settings, `Info.plist` and entitlements. Never edit `WrangURL/Info.plist`, `WrangURL/WrangURL.entitlements` or `WrangURL.xcodeproj` directly. Run `xcodegen generate` after changing it or adding/removing files.
- Each entitlement and unusual build setting in `project.yml` has a comment explaining why it's there. Keep that up for new ones. Keep entitlements minimal: the app is sandboxed, and any new exception needs a concrete reason.
- Don't change `SUFeedURL`, `SUPublicEDKey`, the Sparkle mach-lookup exceptions, `CODE_SIGN_INJECT_BASE_ENTITLEMENTS` or the signing flow in `scripts/resign.sh`/`scripts/release.sh` unless asked. Mistakes there break auto-updates for existing users, and a release can't fix that.
- Don't change `SUFeedURL`, `SUPublicEDKey`, the Sparkle mach-lookup exceptions, `CODE_SIGN_INJECT_BASE_ENTITLEMENTS` or the signing flow in `scripts/release.sh`/`.github/workflows/release.yml` unless asked. Mistakes there break auto-updates for existing users, and a release can't fix that.
- `CHANGELOG.md` sections are added by `.github/workflows/changelog.yml` on release. Don't add release sections by hand. Only reword existing entries when asked.
- CI runs on `macos-26` (the `NSGlassEffectView` SDK). Workflows keep `xcodebuild`'s exit status when piping through `grep`.
- `docs/` is a static GitHub Pages site (plain HTML/CSS/JS, no build step). Keep it dependency-free. Screenshots in `docs/images/` come in light and dark variants, captured with the demo data in `docs/demo/` using the steps in its README.
Expand Down
94 changes: 37 additions & 57 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Builds WrangURL.app when a release is published, signs it with the self-signed "WrangURL Self-Signed"
# certificate and attaches it to the release, along with a Sparkle appcast.xml that installed copies
# check for updates. The app is not notarized, so Gatekeeper blocks it on first launch; use
# scripts/release.sh locally for a Developer ID signed, notarized DMG. The tests (tests.yml) run first
# and must pass.
# Builds WrangURL.app when a release is published, signs it with the Developer ID certificate, notarizes
# and staples it (scripts/release.sh), and attaches a zip, a DMG and a Sparkle appcast.xml, which
# installed copies check for updates, to the release. The tests (tests.yml) run first and must pass.
#
# Requires these secrets:
# SPARKLE_PRIVATE_KEY the EdDSA key whose public half is SUPublicEDKey in project.yml.
# Export it with `generate_keys --account wrangurl -x <file>` (Sparkle's bin/).
# SIGNING_CERTIFICATE_P12 the base64-encoded .p12 of the "WrangURL Self-Signed" identity.
# SIGNING_CERTIFICATE_PASSWORD that .p12's password.
# SPARKLE_PRIVATE_KEY the EdDSA key whose public half is SUPublicEDKey in project.yml.
# Export it with `generate_keys --account wrangurl -x <file>` (Sparkle's bin/).
# DEVELOPER_ID_CERTIFICATE_P12 the base64-encoded .p12 of the "Developer ID Application" identity
# (certificate and private key) for team 3A6RMA5S3D.
# DEVELOPER_ID_CERTIFICATE_PASSWORD that .p12's password.
# NOTARY_API_KEY the base64-encoded .p8 of an App Store Connect API key
# (Users and Access → Integrations → Team Keys, "Developer" role).
# NOTARY_API_KEY_ID that key's ID.
# NOTARY_API_ISSUER_ID the team's issuer ID, shown above the keys.
name: Release

on:
Expand All @@ -35,37 +38,16 @@ jobs:
- name: Install XcodeGen
run: brew install xcodegen

- name: Generate Xcode project
run: xcodegen generate

- name: Build
- name: Install the Developer ID certificate
env:
TAG: ${{ github.event.release.tag_name }}
run: |
# Tags like v1.2.3 become MARKETING_VERSION 1.2.3; the run number becomes the build number.
xcodebuild build -quiet \
-project WrangURL.xcodeproj \
-scheme WrangURL \
-configuration Release \
-destination 'generic/platform=macOS' \
-derivedDataPath build/DerivedData \
-skipPackagePluginValidation \
MARKETING_VERSION="${TAG#v}" \
CURRENT_PROJECT_VERSION="${{ github.run_number }}" \
CODE_SIGN_IDENTITY=- \
CODE_SIGN_STYLE=Manual

- name: Sign with the self-signed certificate
env:
CERTIFICATE_P12: ${{ secrets.SIGNING_CERTIFICATE_P12 }}
CERTIFICATE_PASSWORD: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
CERTIFICATE_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }}
CERTIFICATE_PASSWORD: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }}
run: |
if [ -z "$CERTIFICATE_P12" ] || [ -z "$CERTIFICATE_PASSWORD" ]; then
echo "::error::the SIGNING_CERTIFICATE_P12 and SIGNING_CERTIFICATE_PASSWORD secrets are not set"
echo "::error::the DEVELOPER_ID_CERTIFICATE_P12 and DEVELOPER_ID_CERTIFICATE_PASSWORD secrets are not set"
exit 1
fi
# Xcode refuses an untrusted identity, so the ad-hoc build is re-signed.
# codesign only finds identities in keychains on the search list.
# xcodebuild and codesign only find identities in keychains on the search list.
KEYCHAIN="$RUNNER_TEMP/signing.keychain-db"
KEYCHAIN_PASSWORD=$(openssl rand -base64 24)
echo "$CERTIFICATE_P12" | base64 --decode > "$RUNNER_TEMP/signing.p12"
Expand All @@ -77,29 +59,22 @@ jobs:
security list-keychains -d user -s "$KEYCHAIN" $(security list-keychains -d user | tr -d '"')
rm "$RUNNER_TEMP/signing.p12"

scripts/resign.sh build/DerivedData/Build/Products/Release/WrangURL.app "WrangURL Self-Signed"

- name: Verify signature
run: |
APP=build/DerivedData/Build/Products/Release/WrangURL.app
codesign --verify --deep --strict --verbose=2 "$APP"
# An ad-hoc designated requirement is a hash of this build, so updates would look like a different app.
if ! codesign -d -r- "$APP" 2>&1 | grep -q "certificate root"; then
echo "::error::release build isn't signed with the self-signed certificate"
exit 1
fi
if codesign -d --entitlements - "$APP" 2>/dev/null | grep -q get-task-allow; then
echo "::error::release build has the get-task-allow entitlement"
exit 1
fi

- name: Package
- name: Build, sign and notarize
env:
TAG: ${{ github.event.release.tag_name }}
NOTARY_API_KEY: ${{ secrets.NOTARY_API_KEY }}
NOTARY_KEY_ID: ${{ secrets.NOTARY_API_KEY_ID }}
NOTARY_ISSUER: ${{ secrets.NOTARY_API_ISSUER_ID }}
run: |
ditto -c -k --keepParent \
build/DerivedData/Build/Products/Release/WrangURL.app \
"WrangURL-${TAG#v}.zip"
if [ -z "$NOTARY_API_KEY" ] || [ -z "$NOTARY_KEY_ID" ] || [ -z "$NOTARY_ISSUER" ]; then
echo "::error::the NOTARY_API_KEY, NOTARY_API_KEY_ID and NOTARY_API_ISSUER_ID secrets are not set"
exit 1
fi
export NOTARY_KEY_PATH="$RUNNER_TEMP/notary.p8"
echo "$NOTARY_API_KEY" | base64 --decode > "$NOTARY_KEY_PATH"
# Tags like v1.2.3 become MARKETING_VERSION 1.2.3; the run number becomes the build number.
VERSION="${TAG#v}" BUILD_NUMBER="${{ github.run_number }}" scripts/release.sh
rm "$NOTARY_KEY_PATH"

- name: Generate appcast
env:
Expand All @@ -117,7 +92,7 @@ jobs:

# The appcast lists only this release; Sparkle only needs the newest one.
mkdir updates
cp "WrangURL-${TAG#v}.zip" updates/
cp "build/release/WrangURL-${TAG#v}.zip" updates/
printf '%s\n' "$RELEASE_NOTES" > "updates/WrangURL-${TAG#v}.md"
echo "$SPARKLE_PRIVATE_KEY" | sparkle/bin/generate_appcast \
--ed-key-file - \
Expand All @@ -131,4 +106,9 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name }}
run: gh release upload "$TAG" "WrangURL-${TAG#v}.zip" updates/appcast.xml --clobber
run: |
gh release upload "$TAG" \
"build/release/WrangURL-${TAG#v}.zip" \
"build/release/WrangURL-${TAG#v}.dmg" \
updates/appcast.xml \
--clobber
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ xcodebuild ... test "-only-testing:WrangURLTests/RoutePlannerTests/singleBrowser

Test output includes harmless `com.apple.linkd.autoShortcut` connection errors from the test host; filter them out.

SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized DMG (`SKIP_NOTARIZE=1` to only sign). `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`.
SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized zip and DMG (`SKIP_NOTARIZE=1` to only sign); the release workflow runs it too. `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`.

App logs use subsystem `com.thepublicgood.wrangurl`. In zsh, `log` is a shell builtin, so call `/usr/bin/log stream --level info --predicate 'subsystem == "com.thepublicgood.wrangurl"'`.

Expand Down Expand Up @@ -66,7 +66,7 @@ They reach SwiftUI through `View.appEnvironment(_:)` in `WrangURLApp.swift`, so
- When setting the default browser, confirming the `http` dialog also switches `https`. `makeDefault()` therefore skips schemes already handled and judges success by the final state.
- Release builds set `CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO`, because notarization rejects `get-task-allow`.
- Sparkle needs `SUEnableInstallerLauncherService`, the `-spks`/`-spki` mach-lookup exceptions and `network.client`. Its feed is `releases/latest/download/appcast.xml`, which the release workflow generates and signs with the `SPARKLE_PRIVATE_KEY` secret. Updates are accepted on the EdDSA signature.
- Release builds from CI are built ad-hoc, then re-signed by `scripts/resign.sh` with the self-signed "WrangURL Self-Signed" certificate. Xcode won't sign with an untrusted identity. An ad-hoc designated requirement is the build's hash, so without this each update would look like a different app to macOS. Builds without a Team ID need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`.
- Releases are signed with the Developer ID of team `3A6RMA5S3D` by archiving and exporting (`scripts/release.sh`), which re-signs Sparkle's helpers too; the app and DMG are notarized and stapled. Releases up to 0.5.x were signed with a self-signed certificate. Sparkle accepts the change of code signing identity because the EdDSA key stayed the same, so never change both at once. Ad-hoc builds (local Release builds) have no Team ID and need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`.

## Testing and manual UI checks

Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ xcodebuild ... test "-only-testing:WrangURLTests/RoutePlannerTests/singleBrowser

Test output includes harmless `com.apple.linkd.autoShortcut` connection errors from the test host; filter them out.

SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized DMG (`SKIP_NOTARIZE=1` to only sign). `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`.
SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized zip and DMG (`SKIP_NOTARIZE=1` to only sign); the release workflow runs it too. `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`.

App logs use subsystem `com.thepublicgood.wrangurl`. In zsh, `log` is a shell builtin, so call `/usr/bin/log stream --level info --predicate 'subsystem == "com.thepublicgood.wrangurl"'`.

Expand Down Expand Up @@ -66,7 +66,7 @@ They reach SwiftUI through `View.appEnvironment(_:)` in `WrangURLApp.swift`, so
- When setting the default browser, confirming the `http` dialog also switches `https`. `makeDefault()` therefore skips schemes already handled and judges success by the final state.
- Release builds set `CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO`, because notarization rejects `get-task-allow`.
- Sparkle needs `SUEnableInstallerLauncherService`, the `-spks`/`-spki` mach-lookup exceptions and `network.client`. Its feed is `releases/latest/download/appcast.xml`, which the release workflow generates and signs with the `SPARKLE_PRIVATE_KEY` secret. Updates are accepted on the EdDSA signature.
- Release builds from CI are built ad-hoc, then re-signed by `scripts/resign.sh` with the self-signed "WrangURL Self-Signed" certificate. Xcode won't sign with an untrusted identity. An ad-hoc designated requirement is the build's hash, so without this each update would look like a different app to macOS. Builds without a Team ID need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`.
- Releases are signed with the Developer ID of team `3A6RMA5S3D` by archiving and exporting (`scripts/release.sh`), which re-signs Sparkle's helpers too; the app and DMG are notarized and stapled. Releases up to 0.5.x were signed with a self-signed certificate. Sparkle accepts the change of code signing identity because the EdDSA key stayed the same, so never change both at once. Ad-hoc builds (local Release builds) have no Team ID and need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`.

## Testing and manual UI checks

Expand Down
6 changes: 4 additions & 2 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ enum UnmatchedBehavior: String, Codable {
- Setup is marked complete when its window closes by any means, so it doesn't reappear on every launch. Settings → General → Run Setup Again… reopens it.
- There's no notification when the default browser changes, so WrangURL re-checks whenever the user switches apps. The menubar icon shows a warning while WrangURL isn't the default.
- **Releasing:** `scripts/release.sh` archives with Developer ID signing, notarizes and staples the app, then builds, signs, notarizes and staples a DMG in `build/release/`.
- One-time setup: install a Developer ID Application certificate, then run `xcrun notarytool store-credentials WrangURL --apple-id <email> --team-id RCZ39FHJ3H`.
- One-time setup: install a Developer ID Application certificate, then run `xcrun notarytool store-credentials WrangURL --apple-id <email> --team-id 3A6RMA5S3D`. CI (`release.yml`) runs the same script, with the certificate in a temporary keychain and an App Store Connect API key for `notarytool`.
- `SKIP_NOTARIZE=1` builds and signs only.
- Moving from the self-signed certificate (up to 0.5.x) to the Developer ID changes the designated requirement. Sparkle allows that because the update's EdDSA signature still verifies; changing the EdDSA key at the same time would break updates.
- Exporting re-signs Sparkle's nested helpers with the Developer ID and a secure timestamp, which notarization needs. `Downloader.xpc` ships without entitlements, and stays that way.
- The Release configuration sets `CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO` so the `get-task-allow` entitlement isn't included. Notarization rejects it, and the script checks for it.
- **App icon:** generated by `scripts/make-app-icon.swift` into `Assets.xcassets/AppIcon.appiconset`. The menubar icon stays the `arrow.triangle.branch` SF Symbol, which macOS already draws as a template.
- **Import:** only accepts JSON with a `rules` or `settings` key, so an arbitrary file can't wipe the configuration. It offers Add Rules, which keeps your settings and gives duplicate IDs new ones, or Replace All, which keeps the "setup done" flag.
Expand Down Expand Up @@ -215,7 +217,7 @@ enum UnmatchedBehavior: String, Codable {
- Rules list with reordering.
- Rule editor with the URL tester.
6. ✅ **Default browser & login item management,** plus onboarding.
7. 🟡 **Polish.** Import/export, app icon and menubar icon are done. The notarized build is scripted but blocked until there's a Developer ID Application certificate.
7. 🟡 **Polish.** Import/export, app icon and menubar icon are done. Releases are Developer ID signed and notarized.

## 12. Future ideas

Expand Down
Loading
Loading