Skip to content

Commit 97ec098

Browse files
Nishanthclaude
andcommitted
desktop: finalize local release script + document setup gotchas
release-local.sh: sign the updater payload during build (createUpdaterArtifacts needs TAURI_SIGNING_PRIVATE_KEY), use Tauri's own tarball, brace $PUBLIC_REPO. RELEASING.md: add desktop-ui/.env.local, codesign key-partition-list, and pnpm troubleshooting to the one-time setup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7010aa7 commit 97ec098

2 files changed

Lines changed: 43 additions & 21 deletions

File tree

apps/desktop/RELEASING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@ gh auth status
5858
gh repo view mydevtools-tech/mydevtools-releases
5959
```
6060

61+
**6. Frontend build env** — the desktop UI build requires the Firebase vars.
62+
`apps/desktop-ui/.env.local` is gitignored, so create it once (copy the public vars from web):
63+
```bash
64+
grep '^NEXT_PUBLIC_' apps/web/.env.local > apps/desktop-ui/.env.local
65+
```
66+
67+
**7. Grant codesign keychain access** (fixes `errSecInternalComponent`, since
68+
codesign runs non-interactively inside `tauri build`):
69+
```bash
70+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s \
71+
-k "YOUR_MAC_LOGIN_PASSWORD" ~/Library/Keychains/login.keychain-db
72+
```
73+
74+
> **If `pnpm` fails** with "Failed to switch pnpm to vX" or "Unknown system error -8"
75+
> (a broken managed pnpm on Apple Silicon), disable auto-switching and use the
76+
> installed pnpm: add `manage-package-manager-versions=false` to `~/.npmrc`.
77+
> After any `git pull` that changed dependencies, run `pnpm install`.
78+
6179
### Cutting a release — the commands
6280

6381
```bash

apps/desktop/scripts/release-local.sh

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ VERSION="$(node -p "require('$ROOT/src-tauri/tauri.conf.json').version")"
3838
TAG="v$VERSION"
3939
BUNDLE="$ROOT/src-tauri/target/universal-apple-darwin/release/bundle"
4040
APP="$BUNDLE/macos/MyDevTools.app"
41-
TARBALL_NAME="MyDevTools_${VERSION}_universal.app.tar.gz"
4241
DMG="$BUNDLE/dmg/MyDevTools_${VERSION}_universal.dmg"
4342
OUT="$BUNDLE/macos"
4443

@@ -55,27 +54,32 @@ if gh release view "$TAG" --repo "$PUBLIC_REPO" >/dev/null 2>&1; then
5554
exit 1
5655
fi
5756

58-
# ── 1. build + Apple-sign the universal app (no dmg — we make it via hdiutil) ─
59-
echo "▸ [1/6] Building & signing the app…"
60-
( cd "$ROOT" && pnpm tauri build --bundles app --target universal-apple-darwin )
57+
# ── 1. build: Apple-sign the app AND sign the updater payload ─────────────────
58+
# createUpdaterArtifacts:true makes tauri build emit + sign the .app.tar.gz, so
59+
# TAURI_SIGNING_PRIVATE_KEY must be set here. Letting Tauri produce the tarball
60+
# guarantees it's in the exact format its updater expects.
61+
echo "▸ [1/5] Building & signing the app + updater payload…"
62+
( cd "$ROOT" && \
63+
TAURI_SIGNING_PRIVATE_KEY="$(cat "$KEYFILE")" \
64+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD="$PW" \
65+
pnpm tauri build --bundles app --target universal-apple-darwin )
6166

62-
# ── 2. notarize + staple the .app (so both the tarball and dmg carry a ticket)─
63-
echo "▸ [2/6] Notarizing & stapling the app…"
67+
# Locate the updater artifacts Tauri just produced (name varies by version).
68+
TARGZ="$(ls "$OUT"/*.app.tar.gz 2>/dev/null | head -1)"
69+
SIG="${TARGZ}.sig"
70+
TARBALL_NAME="$(basename "$TARGZ")"
71+
[ -f "$TARGZ" ] && [ -f "$SIG" ] || { echo "release-local: updater artifacts not found in $OUT" >&2; exit 1; }
72+
73+
# ── 2. notarize + staple the .app (for the DMG download path) ─────────────────
74+
echo "▸ [2/5] Notarizing & stapling the app…"
6475
APP_ZIP="$(mktemp -d)/app.zip"
6576
ditto -c -k --keepParent "$APP" "$APP_ZIP"
6677
xcrun notarytool submit "$APP_ZIP" --keychain-profile "$NOTARY_PROFILE" --wait
6778
xcrun stapler staple "$APP"
6879
rm -f "$APP_ZIP"
6980

70-
# ── 3. updater payload: tar the stapled app, then sign it with the updater key ─
71-
echo "▸ [3/6] Building & signing the updater payload…"
72-
rm -f "$OUT/$TARBALL_NAME" "$OUT/$TARBALL_NAME.sig"
73-
# COPYFILE_DISABLE strips macOS AppleDouble (._*) entries the updater can't use.
74-
COPYFILE_DISABLE=1 tar -czf "$OUT/$TARBALL_NAME" -C "$(dirname "$APP")" "$(basename "$APP")"
75-
npx tauri signer sign -f "$KEYFILE" -p "$PW" "$OUT/$TARBALL_NAME" # -> $TARBALL_NAME.sig
76-
77-
# ── 4. DMG for fresh downloads: hdiutil (deterministic), sign, notarize, staple ─
78-
echo "▸ [4/6] Building, signing & notarizing the DMG…"
81+
# ── 3. DMG for fresh downloads: hdiutil (deterministic), sign, notarize, staple ─
82+
echo "▸ [3/5] Building, signing & notarizing the DMG…"
7983
mkdir -p "$BUNDLE/dmg"
8084
STAGE="$(mktemp -d)"
8185
cp -R "$APP" "$STAGE/"
@@ -87,10 +91,10 @@ codesign --force --sign "$APPLE_SIGNING_IDENTITY" "$DMG"
8791
xcrun notarytool submit "$DMG" --keychain-profile "$NOTARY_PROFILE" --wait
8892
xcrun stapler staple "$DMG"
8993

90-
# ── 5. latest.json: manifest the updater reads (signature + public URL) ───────
91-
echo "▸ [5/6] Writing latest.json…"
94+
# ── 4. latest.json: manifest the updater reads (signature + public URL) ───────
95+
echo "▸ [4/5] Writing latest.json…"
9296
LATEST="$OUT/latest.json"
93-
SIG_CONTENT="$(cat "$OUT/$TARBALL_NAME.sig")" \
97+
SIG_CONTENT="$(cat "$SIG")" \
9498
TARGZ_URL="https://github.com/$PUBLIC_REPO/releases/download/$TAG/$TARBALL_NAME" \
9599
VERSION="$VERSION" \
96100
PUBDATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
@@ -112,12 +116,12 @@ node -e '
112116
fs.writeFileSync(process.env.LATEST_OUT, JSON.stringify(manifest, null, 2));
113117
'
114118

115-
# ── 6. publish everything to the PUBLIC repo ─────────────────────────────────
116-
echo "▸ [6/6] Publishing to $PUBLIC_REPO"
119+
# ── 5. publish everything to the PUBLIC repo ─────────────────────────────────
120+
echo "▸ [5/5] Publishing to ${PUBLIC_REPO} ..."
117121
gh release create "$TAG" --repo "$PUBLIC_REPO" \
118122
--title "MyDevTools $TAG" --notes "MyDevTools desktop $TAG"
119123
gh release upload "$TAG" --repo "$PUBLIC_REPO" --clobber \
120-
"$DMG" "$OUT/$TARBALL_NAME" "$OUT/$TARBALL_NAME.sig" "$LATEST"
124+
"$DMG" "$TARGZ" "$SIG" "$LATEST"
121125

122126
echo ""
123127
echo "✅ Published v$VERSION. Installed apps will offer the update on next launch."

0 commit comments

Comments
 (0)