Files
work-app/scripts/ship.sh
T
Vincent aa19da48de Stop announcing the same email twice
Both notification paths feed one channel, which is how a single arrival
came to be announced twice: Gmail names the sender, then the unread count
says "1 new" behind it seconds later.

A count is now skipped when the app has spoken for itself in the last
twenty seconds - generous, because a count is only noticed on a
four-second tick, well after the app raised its own. Settings can also
turn count notifications off outright, for hearing only what an app says
in its own words, at the cost of the tools that never say anything.

`npm run ship` now updates only /Applications. The Desktop installer
moved behind `--dmg`, for when a build is going to someone else.
2026-09-02 09:36:57 +02:00

62 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Build once, then put the result in both places, every time:
#
# /Applications/Work.app the copy being tested here
#
# Pass --dmg to also drop a drag-to-Applications installer on the Desktop, from
# the same build — so the thing a tester runs is byte for byte the thing that
# was just tested here, rather than a second build that drifted.
set -euo pipefail
WANT_DMG=0
[ "${1:-}" = "--dmg" ] && WANT_DMG=1
cd "$(dirname "$0")/.."
APP="Work.app"
BUILT="src-tauri/target/release/bundle/macos/$APP"
DEST="/Applications/$APP"
VERSION="$(node -p "require('./package.json').version")"
DMG="$HOME/Desktop/Work-$VERSION.dmg"
echo "==> building $VERSION"
if [ "$WANT_DMG" = "1" ]; then
npm run tauri build -- --bundles app,dmg
else
npm run tauri build -- --bundles app
fi
echo "==> quitting the running copy"
osascript -e 'quit app "Work"' >/dev/null 2>&1 || true
# A hung window would otherwise keep the bundle busy while it is replaced.
pkill -f "Work.app/Contents/MacOS" >/dev/null 2>&1 || true
for _ in 1 2 3 4 5 6 7 8 9 10; do
pgrep -f "Work.app/Contents/MacOS" >/dev/null || break
sleep 0.3
done
echo "==> installing to $DEST"
rm -rf "$DEST"
cp -R "$BUILT" "$DEST"
# The disk image, only when asked for — drag-to-Applications, which is what
# someone expects to be handed rather than a bare bundle to file themselves.
if [ "$WANT_DMG" = "1" ]; then
echo "==> copying the installer to $DMG"
BUILT_DMG="$(find src-tauri/target/release/bundle/dmg -name '*.dmg' -maxdepth 1 | head -1)"
if [ -z "$BUILT_DMG" ]; then
echo "no .dmg was produced — check the bundler output above" >&2
exit 1
fi
rm -f "$DMG"
cp "$BUILT_DMG" "$DMG"
fi
echo "==> launching"
open "$DEST"
if [ "$WANT_DMG" = "1" ]; then
echo "==> done — $DEST and $DMG"
else
echo "==> done — $DEST"
fi