-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake-app.sh
More file actions
executable file
·50 lines (44 loc) · 1.75 KB
/
Copy pathmake-app.sh
File metadata and controls
executable file
·50 lines (44 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/zsh
# Builds BarKeep.app into dist/ and (re)launches it.
#
# Code signing: uses $BARKEEP_SIGN_IDENTITY if set, otherwise prefers the first
# Developer ID Application identity, then Apple Development, then ad-hoc.
# Developer ID builds use hardened runtime and a secure timestamp.
set -euo pipefail
cd "$(dirname "$0")"
swift build -c release
APP="dist/BarKeep.app"
rm -rf "$APP"
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
cp packaging/Info.plist "$APP/Contents/Info.plist"
cp .build/release/BarKeep "$APP/Contents/MacOS/BarKeep"
[ -f assets/AppIcon.icns ] && cp assets/AppIcon.icns "$APP/Contents/Resources/AppIcon.icns"
if [ -n "${BARKEEP_SIGN_IDENTITY:-}" ]; then
IDENTITY="$BARKEEP_SIGN_IDENTITY"
else
# Keychain output is not ordered by certificate type. Select Developer ID
# explicitly so local rebuilds keep the same TCC identity as distributed builds.
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null \
| grep 'Developer ID Application' | grep -v REVOKED \
| head -1 | sed 's/^[^"]*"//; s/"$//' || true)"
if [ -z "$IDENTITY" ]; then
IDENTITY="$(security find-identity -v -p codesigning 2>/dev/null \
| grep 'Apple Development' | grep -v REVOKED \
| head -1 | sed 's/^[^"]*"//; s/"$//' || true)"
fi
fi
if [ -n "$IDENTITY" ]; then
if [[ "$IDENTITY" == Developer\ ID\ Application:* ]]; then
codesign --force --options runtime --timestamp -s "$IDENTITY" "$APP"
else
codesign --force -s "$IDENTITY" "$APP"
fi
echo "Signed with: $IDENTITY"
else
codesign --force -s - "$APP"
echo "Signed ad-hoc (Full Disk Access will need re-granting after each rebuild)"
fi
pkill -x BarKeep 2>/dev/null || true
sleep 0.5
open "$APP"
echo "Launched $APP"