-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
Β·480 lines (462 loc) Β· 16.7 KB
/
Copy pathrun.sh
File metadata and controls
executable file
Β·480 lines (462 loc) Β· 16.7 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
#!/bin/bash
# BongoCat Build Menu Script
# Interactive menu to run different build and package commands
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
print_info() { echo -e "${BLUE}βΉοΈ $1${NC}"; }
print_success() { echo -e "${GREEN}β
$1${NC}"; }
print_error() { echo -e "${RED}β $1${NC}"; }
print_warning() { echo -e "${YELLOW}β οΈ $1${NC}"; }
# Default values
VERBOSE=true
print_info "Sourcing .env file..."
source .env
# Function to show usage
show_usage() {
echo "π± BongoCat Build Menu"
echo "======================"
echo ""
echo "Usage: $0 [OPTION]"
echo ""
echo "Build Options:"
echo " --verify, -v Verify environment and setup"
echo " --build, -b Build app (debug)"
echo " --build-debug, -bd Build app in debug mode"
echo " --build-release, -br Build app in release mode"
echo " --test, -t Run tests"
echo " --run, -r Run the app"
echo " --install, -i Install app locally"
echo ""
echo "Package Options:"
echo " --package, -p Package app (DMG and PKG)"
echo " --sign, -s Sign app and notarize"
echo " --push, -u Push to GitHub and/or App Store"
echo ""
echo "Combined Workflows:"
echo " --debug-all, -da Build debug, test, run, install"
echo " --release-all, -ra Build release, package, sign, push"
echo " --deliver, -d Complete delivery workflow"
echo " --app-store, -as App Store distribution workflow"
echo ""
echo "Version Management:"
echo " --check-versions, -cv Check version consistency"
echo " --bump-version, -bv Bump version (requires version number)"
echo " --verify-signatures, -vs Verify signatures comprehensively"
echo ""
echo "Debug Options:"
echo " --verbose, -V Enable verbose output for debugging"
echo ""
echo "Custom Combinations:"
echo " --build-test-run, -btr Build + Test + Run"
echo " --build-test-package-sign, -btps Build + Test + Package + Sign"
echo " --build-test-package-sign-push, -btpsp Build + Test + Package + Sign + Push"
echo ""
echo "Examples:"
echo " $0 --verify"
echo " $0 --verify --verbose"
echo " $0 --build --test"
echo " $0 --release-all"
echo " $0 --deliver 1.3.0"
echo " $0 --check-versions"
echo " $0 --bump-version 1.3.0"
echo " $0 --build-test-run"
echo " $0 --build-package-sign-push"
echo ""
echo "π§ Build Scripts:"
echo " β’ build.sh: Build, test, run, install"
echo " β’ verify.sh: Environment and signature verification"
echo " β’ package.sh: DMG and PKG generation"
echo " β’ sign.sh: Code signing and notarization"
echo " β’ push.sh: GitHub and App Store distribution"
echo " β’ bump_version.sh: Version management"
echo " β’ check_version.sh: Version consistency verification"
echo ""
echo "If no arguments are provided, the interactive menu will be shown."
}
# Function to check delivery prerequisites
check_delivery_prerequisites() {
echo "π Checking delivery prerequisites..."
# Check for Apple ID credentials for notarization
if [ -z "$APPLE_ID" ] || [ -z "$APPLE_ID_PASSWORD" ] || [ -z "$TEAM_ID" ]; then
echo "β οΈ Apple notarization credentials not fully set"
if [ -z "$APPLE_ID" ]; then
echo " β’ APPLE_ID not set"
fi
if [ -z "$APPLE_ID_PASSWORD" ]; then
echo " β’ APPLE_ID_PASSWORD not set"
fi
if [ -z "$TEAM_ID" ]; then
echo " β’ TEAM_ID not set"
fi
echo " β’ App will be delivered without notarization"
echo " β’ Users may see security warnings on first launch"
echo " β’ To enable notarization, set:"
echo " export APPLE_ID='your-apple-id@example.com'"
echo " export APPLE_ID_PASSWORD='your-app-specific-password'"
echo " export TEAM_ID='your-team-id'"
echo ""
else
echo "β
Apple ID credentials and Team ID found - notarization will be attempted"
fi
# Check for code signing certificate
if [ -f "Scripts/sign.sh" ]; then
source "Scripts/sign.sh"
if check_developer_certificate; then
echo "β
Apple Developer certificate found"
else
echo "β οΈ No Apple Developer certificate found - will use ad-hoc signing"
fi
else
echo "β οΈ Sign script not found"
fi
echo ""
}
# Function to execute the selected option
execute_option() {
local choice=$1
local version=$2
case $choice in
0)
echo "π Verifying environment and setup..."
if [ "$VERBOSE" = true ]; then
./Scripts/verify.sh --all --verbose
else
./Scripts/verify.sh --all
fi
;;
1)
echo "π¨ Building app (debug)..."
./Scripts/build.sh --debug
;;
2)
echo "π¨ Building app (release)..."
./Scripts/build.sh --release
;;
3)
echo "π§ͺ Running tests..."
./Scripts/build.sh --test
;;
4)
echo "π Running app..."
./Scripts/build.sh --run
;;
5)
echo "π¦ Installing app locally..."
./Scripts/build.sh --install
;;
6)
echo "π¦ Packaging app..."
./Scripts/package.sh
;;
7)
echo "π Signing app..."
./Scripts/sign.sh --app
;;
8)
echo "π Pushing to distribution..."
./Scripts/push.sh
;;
12)
echo "π¨ Complete debug workflow..."
./Scripts/build.sh --all
;;
13)
echo "π Complete release workflow..."
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Running: ./Scripts/push.sh --bump --commit --push-commit"
./Scripts/push.sh --bump --commit --push-commit
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π¨ Running: ./Scripts/build.sh --release --clean"
./Scripts/build.sh --release --clean
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π¦ Running: ./Scripts/package.sh --app"
./Scripts/package.sh --app
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Running: ./Scripts/sign.sh --app"
./Scripts/sign.sh --app
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
# ./Scripts/verify.sh --app-store-requirements Done in push.sh
echo "π¦ Running: ./Scripts/package.sh --dmg"
./Scripts/package.sh --dmg
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Running: ./Scripts/sign.sh --dmg"
./Scripts/sign.sh --dmg
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Running: ./Scripts/sign.sh --notarize-dmg"
./Scripts/sign.sh --notarize-dmg
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π¦ Running: ./Scripts/package.sh --pkg"
./Scripts/package.sh --pkg
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Running: ./Scripts/sign.sh --pkg"
./Scripts/sign.sh --pkg
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Running: ./Scripts/verify.sh --signatures"
./Scripts/verify.sh --signatures
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π Running: ./Scripts/verify.sh --notarize-dmg"
./Scripts/verify.sh --notarize-dmg
echo "βββββββββββββββββββββββββββββββββββββββββββββββ"
# ./Scripts/push.sh --github --app-store
;;
14)
if [ -z "$version" ]; then
echo "β Version number is required for deliver option!"
echo " Usage: $0 --deliver <version>"
exit 1
fi
check_delivery_prerequisites
echo "π·οΈ Complete delivery workflow for version $version..."
./Scripts/push.sh --bump "$version" --commit --push-commit
./Scripts/build.sh --release
./Scripts/package.sh
./Scripts/sign.sh --all
./Scripts/push.sh --all
;;
15)
echo "π App Store distribution workflow..."
./Scripts/build.sh --release
./Scripts/package.sh --app-store
./Scripts/sign.sh --app
./Scripts/push.sh --app-store
;;
*)
echo "β Invalid option."
exit 1
;;
esac
}
# Parse command line arguments
if [ $# -eq 0 ]; then
# No arguments provided, show interactive menu
echo "π± BongoCat Build Menu"
echo "======================"
echo ""
echo "Please select an option:"
echo ""
echo "π§ Build Options:"
echo "0) Verify environment and setup"
echo "1) Build app (debug)"
echo "2) Build app (release)"
echo "3) Run tests"
echo "4) Run app"
echo "5) Install app locally"
echo ""
echo "π¦ Package Options:"
echo "6) Package app (DMG and PKG)"
echo "7) Sign app"
echo "8) Push to distribution"
echo ""
echo "π Verification Options:"
echo "9) Verify signatures comprehensively"
echo "10) Check version consistency"
echo ""
echo "π·οΈ Version Management:"
echo "11) Bump version (interactive)"
echo ""
echo "π Workflows:"
echo "12) Complete debug workflow"
echo "13) Complete release workflow"
echo "14) Complete delivery workflow"
echo "15) App Store distribution workflow"
echo ""
echo "π Custom Combinations:"
echo "16) Build + Test + Run"
echo "17) Build + Test + Package + Sign"
echo "18) Build + Test + Package + Sign + Push"
echo ""
echo "19) Exit"
echo ""
read -p "Enter your choice (0-19): " choice
case $choice in
0|1|2|3|4|5|6|7|8)
execute_option $choice
;;
9)
echo "π Verifying signatures comprehensively..."
if [ "$VERBOSE" = true ]; then
./Scripts/verify.sh --signatures --verbose
else
./Scripts/verify.sh --signatures
fi
;;
10)
echo "π Checking version consistency..."
./Scripts/check_version.sh
;;
11)
echo "π·οΈ Bumping version (interactive)..."
read -p "Enter new version number (e.g., 1.3.0): " version
if [ -z "$version" ]; then
echo "β Version number is required!"
exit 1
fi
./Scripts/bump_version.sh "$version"
;;
12|13|14|15)
execute_option $choice
;;
16)
echo "π Build + Test + Run workflow..."
./Scripts/build.sh --test --run
;;
17)
echo "π Build + Test + Package + Sign workflow..."
./Scripts/build.sh --release --test
./Scripts/package.sh
./Scripts/sign.sh --app
;;
18)
echo "π Build + Test + Package + Sign + Push workflow..."
./Scripts/build.sh --release --test
./Scripts/package.sh
./Scripts/sign.sh --app
./Scripts/push.sh --github
;;
19)
echo "π Goodbye!"
exit 0
;;
*)
echo "β Invalid option. Please choose 0-19."
exit 1
;;
esac
else
# Parse command line arguments
# Handle verbose flag first
while [[ $# -gt 0 ]]; do
case "$1" in
--verbose|-V)
VERBOSE=true
shift
;;
*)
break
;;
esac
done
# Reset arguments after processing verbose flag
set -- "$@"
case "$1" in
--verify|-v)
if [ "$VERBOSE" = true ]; then
echo "π Verifying environment and setup..."
./Scripts/verify.sh --all --verbose
else
execute_option 0
fi
;;
--build|-b)
execute_option 1
;;
--build-debug|-bd)
execute_option 1
;;
--build-release|-br)
execute_option 2
;;
--test|-t)
execute_option 3
;;
--run|-r)
execute_option 4
;;
--install|-i)
execute_option 5
;;
--package|-p)
execute_option 6
;;
--sign|-s)
execute_option 7
;;
--push|-u)
execute_option 8
;;
--debug-all|-da)
execute_option 12
;;
--release-all|-ra)
execute_option 13
;;
--deliver|-d)
if [ -z "$2" ]; then
echo "β Version number is required for deliver option!"
echo " Usage: $0 --deliver <version>"
exit 1
fi
execute_option 14 "$2"
;;
--app-store|-as)
execute_option 15
;;
--check-versions|-cv)
echo "π Checking version consistency..."
./Scripts/check_version.sh
;;
--verify-signatures|-vs)
echo "π Verifying signatures comprehensively..."
if [ "$VERBOSE" = true ]; then
./Scripts/verify.sh --signatures --verbose
else
./Scripts/verify.sh --signatures
fi
;;
--bump-version|-bv)
if [ -z "$2" ]; then
echo "β Version number is required for bump-version option!"
echo " Usage: $0 --bump-version <version>"
exit 1
fi
echo "π·οΈ Bumping version to $2..."
./Scripts/bump_version.sh "$2"
;;
--build-test-run|-btr)
echo "π Build + Test + Run workflow..."
./Scripts/build.sh --test --run
;;
--build-package-sign|-bps)
echo "π Build + Package + Sign workflow..."
./Scripts/build.sh --release
./Scripts/package.sh
./Scripts/sign.sh --app
;;
--build-package-sign-push|-bpsp)
echo "π Build + Package + Sign + Push workflow..."
./Scripts/build.sh --release
./Scripts/package.sh
./Scripts/sign.sh --app
./Scripts/push.sh --github
;;
--build-test-package-sign|-btps)
echo "π Build + Test + Package + Sign workflow..."
./Scripts/build.sh --release --test
./Scripts/package.sh
./Scripts/sign.sh --app
;;
--build-test-package-sign-push|-btpsp)
echo "π Build + Test + Package + Sign + Push workflow..."
./Scripts/build.sh --release --test
./Scripts/package.sh
./Scripts/sign.sh --app
./Scripts/push.sh --github
;;
--help|-h)
show_usage
exit 0
;;
*)
echo "β Unknown option: $1"
echo ""
show_usage
exit 1
;;
esac
fi
echo ""
echo "β
Operation completed!"