#! /bin/sh scheme_name="Test" workspace_path="/Users/xueshan1/Desktop/test/Test.xcworkspace" configuration="Release" archive_path="/Users/xueshan1/Desktop/archive/Test.xcarchive" ipa_path="/Users/xueshan1/Desktop/archive/ipa" plist_path="/Users/xueshan1/Desktop/ExportOptions.plist" #archive if [ -d $archive_path ] then echo "已经archive" else xcodebuild archive -workspace ${workspace_path} -scheme ${scheme_name} \ -configuration ${configuration} \ -archivePath ${archive_path} -quiet || exit fi #ipa if [ -d $ipa_path ] then echo "已经ipa" else xcodebuild -exportArchive -archivePath ${archive_path} \ -configuration ${configuration} \ -exportPath ${ipa_path} \ -exportOptionsPlist ${plist_path} \ -quiet || exit fi #upload curl -F "file=@${ipa_path}/Test.ipa" -F "uKey=fee85d13ecc10a5ec9ada3970980effe" -F "_api_key=6020ead819ab9a24d0ad6a39b82d50e1" -F "password=maxueshan123" https://www.pgyer.com/apiv1/app/upload if [ $? = 0 ] then echo 'success ????' else echo '???? NO' fi