#!/usr/bin/env Bash # name:admin echo "~~~~~~~~~~~~~~~~ starts executing script ~~~~~~~~~~~~~~~~" #开始时间 begintime= ' date +%s ' date= ' Date ' +% Y-%m-%d-%t ' #需要编译的 targetName target_name= "wheatmoneymanagement" #编译模式 project defaults to Debug release configuration_target= Release #编译路径 buildpath=/opt/demo/build/${target_name}_${date} #archivePath archivepath=${buildpath}/${target_name
plist adhocexportoptionsplist=${archivepath}/info.plist}.xcarchive #输出的ipa目录 ipapath=/users/admin/desktop #导出ipa required Exportoptionsplist=${adhocexportoptionsplist} # Whether to upload Dandelion uploadpgyer=true # git project branch number breach=v2.0.0 git clone-b $breach Project Git address echo "~~~~~~~~~~~~~~~~ started building ~~~~~~~~~~~~~~~~~~~" #开始构建 xcodebuild archive-workspace ${target_name}.xcworkspace \-scheme ${target_name} \-archivepath ${archivepath} \-configuration ${configuration_target} echo ~~~~~~~~~~~~~~~~ check Build Success ~~~~~~~~~~~~~~~~~~~ "# xcarchive is actually a folder is not a file so use-D to judge if [D" $ARCHIVEPATH "] then echo" Build success ... "Else echo "Build failed ..." Rm-rf $BUILDPATH exit 1 fi endtime= ' Date +%s ' archivetime= build time $[endtime-begintime] sec ' echo ' ~~~~~~~~~~~~~~~~ export ipa~~~~~~~~~~~~~~~~~~~ ' begintime= ' date +%s ' xcodebuild-exportarchive \-archivepath ${archivepath} \-exportoptionsplist ${exportoptionsplist} \-exportPath $ {Ipapath} echo ' ~~~~~~~~~~~~~~~~ Check for successful export of ipa~~~~~~~~~~~~~~~~~~~ ' Ipapath=${ipapath}/${target_name}.ipa if [f ' $ Ipapath "] then echo" Export IPA success ... "Else echo" Export IPA failed ... "# End time Endtime= ' Date +%s ' echo $ArchiveTime ' echo ' to export IPA time $[Endtime-begintime] sec "Exit 1 fi endtime= ' date +%s ' exporttime=" Export IPA time $[endtime-begintime] seconds "# upload dandelion If [$ Uploadpgyer = True]; Then echo "~~~~~~~~~~~~~~~~ upload IPA to dandelion ~~~~~~~~~~~~~~~~~~~" curl-f "file=@ $IPAPATH" \ F "Ukey=9c86dd6f*******d7 D784e841d91 "\ f" _api_key=220fd5e840f******bdb80e2e80 "\ F" password= dandelion password "\ https://www.pgyer.com/apiv1/a Pp/upload If [$ = 0] then echo-e "\ n" echo "~~~~~~~~~~~~~~~~ upload dandelion Success ~~~~~~~~~~~~~~~~~~~" Else EC
Ho-e "\ n" echo "~~~~~~~~~~~~~~~~ upload dandelion failed ~~~~~~~~~~~~~~~~~~~" fi fi echo "~~~~~~~~~~~~~~~~ configuration information ~~~~~~~~~~~~~~~~~~~" Echo "Start script time: ${date}" echo "compilation Mode: ${configuration_target}" echo "Export IPA configuration: ${exportoptionsplist}" echo "Package file path: ${archivepa
TH} "echo" Exports IPA path: ${ipapath} "echo" $ArchiveTime "echo" $ExportTime "Exit 1