-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_distribution.sh
More file actions
executable file
·108 lines (86 loc) · 3.07 KB
/
build_distribution.sh
File metadata and controls
executable file
·108 lines (86 loc) · 3.07 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
set -e
echo "🏗️ Building Snap for Distribution"
echo "=================================="
PROJECT_NAME="snap"
SCHEME_NAME="snap"
ARCHIVE_PATH="./build/snap.xcarchive"
EXPORT_PATH="./build/Release"
DMG_PATH="./build/Snap-1.0.dmg"
echo "📁 Creating build directory..."
mkdir -p build
echo "🧹 Cleaning previous builds..."
xcodebuild clean -project "$PROJECT_NAME.xcodeproj" -scheme "$SCHEME_NAME"
rm -rf build/*
echo "📦 Building and archiving app..."
xcodebuild archive \
-project "$PROJECT_NAME.xcodeproj" \
-scheme "$SCHEME_NAME" \
-configuration Release \
-archivePath "$ARCHIVE_PATH" \
CODE_SIGN_STYLE=Automatic \
DEVELOPMENT_TEAM=Z8988US23Z
echo "✅ Archive created successfully"
echo "📤 Exporting signed app..."
cat > build/ExportOptions.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>development</string>
<key>teamID</key>
<string>Z8988US23Z</string>
<key>signingStyle</key>
<string>automatic</string>
<key>destination</key>
<string>export</string>
</dict>
</plist>
EOF
xcodebuild -exportArchive \
-archivePath "$ARCHIVE_PATH" \
-exportPath "$EXPORT_PATH" \
-exportOptionsPlist build/ExportOptions.plist
echo "✅ App exported successfully"
APP_PATH="$EXPORT_PATH/snap.app"
if [ ! -d "$APP_PATH" ]; then
echo "❌ Error: App not found at $APP_PATH"
exit 1
fi
echo "🔍 Verifying code signature..."
codesign --verify --verbose=2 "$APP_PATH"
echo "✅ Code signature verified"
echo "📋 Checking entitlements..."
codesign -d --entitlements :- "$APP_PATH"
echo "🔒 Verifying Gatekeeper compatibility..."
spctl --assess --type execute --verbose "$APP_PATH" || echo "⚠️ App may require user approval to run on other machines"
echo "💿 Creating DMG for distribution..."
DMG_TEMP_DIR="./build/dmg_temp"
mkdir -p "$DMG_TEMP_DIR"
cp -R "$APP_PATH" "$DMG_TEMP_DIR/"
if [ -f "snap-logo.png" ]; then
cp "snap-logo.png" "$DMG_TEMP_DIR/.background.png"
fi
hdiutil create \
-volname "Snap" \
-srcfolder "$DMG_TEMP_DIR" \
-ov \
-format UDZO \
"$DMG_PATH"
echo "✅ DMG created successfully"
echo "🎉 Distribution package ready!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📁 App Bundle: $APP_PATH"
echo "💿 DMG Package: $DMG_PATH"
echo ""
echo "📝 Installation Instructions:"
echo "1. Share the DMG file with other users"
echo "2. Users should mount the DMG and drag Snap.app to Applications"
echo "3. On first run, users may need to:"
echo " • Right-click the app and select 'Open'"
echo " • Or go to System Preferences > Security & Privacy to allow the app"
echo ""
echo "🔧 For wider distribution without user warnings:"
echo "• Get a Developer ID Application certificate from Apple"
echo "• Run the notarize.sh script for full notarization"