-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_installers.sh
More file actions
executable file
·65 lines (53 loc) · 1.63 KB
/
create_installers.sh
File metadata and controls
executable file
·65 lines (53 loc) · 1.63 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
#!/bin/bash
# Configuration
APP_NAME="Pastely"
SCHEME="Pastely"
BUILD_DIR="./build"
RELEASE_DIR="$BUILD_DIR/Release"
APP_PATH="$RELEASE_DIR/$APP_NAME.app"
OUTPUT_DIR="./installers"
# 1. Clean and Build
echo "Building $APP_NAME..."
xcodebuild -project "$APP_NAME.xcodeproj" \
-scheme "$SCHEME" \
-configuration Release \
-destination 'generic/platform=macOS' \
-derivedDataPath "$BUILD_DIR" \
clean build \
| xcbeautify 2>/dev/null || cat
if [ ! -d "$APP_PATH" ]; then
echo "Error: App build failed. $APP_PATH not found."
exit 1
fi
mkdir -p "$OUTPUT_DIR"
# 2. Create DMG
echo "Creating DMG..."
DMG_NAME="$APP_NAME.dmg"
DMG_PATH="$OUTPUT_DIR/$DMG_NAME"
VOL_NAME="$APP_NAME"
# Create a temporary folder for the DMG content
TMP_DMG_DIR=$(mktemp -d)
cp -r "$APP_PATH" "$TMP_DMG_DIR/"
ln -s /Applications "$TMP_DMG_DIR/Applications"
# Generate DMG using hdiutil
rm -f "$DMG_PATH"
hdiutil create \
-volname "$VOL_NAME" \
-srcfolder "$TMP_DMG_DIR" \
-ov -format UDZO \
"$DMG_PATH"
echo "✅ DMG created at: $DMG_PATH"
rm -rf "$TMP_DMG_DIR"
# 3. Create PKG (Optional)
echo "Creating PKG..."
PKG_PATH="$OUTPUT_DIR/$APP_NAME.pkg"
# Use productbuild to create a simple installer
# Note: For strict distribution, you usually need to sign this with a Developer ID Installer certificate
# passing --sign "Developer ID Installer: Your Name (TeamID)"
productbuild \
--component "$APP_PATH" /Applications \
"$PKG_PATH"
echo "✅ PKG created at: $PKG_PATH"
echo "--------------------------------------------------"
echo "Installers ready in $OUTPUT_DIR"
open "$OUTPUT_DIR"