The Desktop artefact is now Work-<version>.dmg rather than a zip: an installer is what someone expects to be handed, rather than a bare bundle to file away themselves. Same single build behind both destinations.
49 lines
1.6 KiB
Bash
Executable File
49 lines
1.6 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
|
|
# ~/Desktop/Work-<version>.dmg the installer to send someone else
|
|
#
|
|
# One build, two destinations — 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
|
|
|
|
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"
|
|
npm run tauri build -- --bundles app,dmg
|
|
|
|
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 the bundler just made — drag-to-Applications, which is what
|
|
# someone expects to be handed rather than a bare bundle to file themselves.
|
|
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"
|
|
|
|
echo "==> launching"
|
|
open "$DEST"
|
|
echo "==> done — $DEST and $DMG"
|