-
Notifications
You must be signed in to change notification settings - Fork 3
/
buildscript.sh
executable file
·89 lines (58 loc) · 2.87 KB
/
buildscript.sh
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
#!/bin/bash
#
#https://developer.apple.com/library/archive/qa/qa1827/_index.html
read -p "enter app scheme : `echo $'\n> '`" appScheme
##subsequen commented lines below are going to be useful for batch updates version of the script at the moment this script just bumps version automatically.
# read -p "is this a new release or a batch release ? enter Y for the former and N for the latter" isNewRelease
# #for batch
# currentVersion=0.0;
# function getVersion() {
# $currentVersion = agvtool mvers -terse1
# echo $currentVersion
# }
# if $isNewRelease == 'Y' {
# $currentVersion = $currentVersion+1.0
# }
# echo $currentVersion
#for new release
# echo Input new version number format x.y! or retain old version of same format!
# read versionNumber
read -p "Input new version number format x.y.z or retain old version of same format! : `echo $'\n> '`" versionNumber
echo updating version number..
agvtool new-marketing-version $versionNumber > cottylane.txt #Updates Version Number to specific version format is versionnumber(buildnumber)
echo Resetting build number to 1 for new release..
agvtool new-version -all 1 >>/dev/null
# agvtool next-version -all >>/dev/null increment build number to next highest integer. should be for updates.
fullversion="$(agvtool mvers -terse1)($(agvtool vers -terse))"
function build() {
xcodebuild -scheme $appScheme -configuration Staging -workspace $appScheme.xcworkspace/ build >> cottylane.txt
}
function archive() {
xcodebuild -scheme $appScheme -configuration Staging -workspace $appScheme.xcworkspace/ archive -archivePath $PWD/build/$appScheme.xcarchive >> cottylane.txt #archive
}
function exportIPA() {
xcodebuild -exportArchive -archivePath $PWD/build/$appScheme.xcarchive -exportOptionsPlist OptionsPlist.plist -exportPath $PWD/build >> cottylane.txt
}
function upload() {
echo cleaning UploadTokens..
rm -rf /Library/Caches/com.apple.amp.itmstransporter/UploadTokens/*
/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool --upload-app -f $PWD/build/$appScheme.ipa -u [email protected] -p $OTP > cottylane.txt
}
echo building version $fullversion ..
if build; then echo build completed .
else echo Build failed..
fi
echo archiving version $fullversion ..
if archive; then echo archive completed .
else echo archive failed..
fi
echo exporting IPA of version $fullversion ..
if exportIPA; then echo completed exporting IPA .
else echo export of IPA failed..
fi
echo App-specific Password is needed #generate OTP from appleid.apple.com; from the security section click Generate Passwords and use FBNIIOS as app password,
read OTP
if upload; then echo IPA file has been uploaded to TestFlight
# elif rm -rf $PWD/build/FBNInsurance.ipa; then upload ; echo Uploaded.
else echo OOps an error occured, rerun script.
fi