ios packaging

# iOS RELEASE ## 构建 ### Execute shell 命令 rm -rf ${WORKSPACE}/Export ### Conditional steps(multiple) Run? [And] && [Boolean condition] Token [${RebuildXcodeProject}] && [Not] ! [String mantch] String 1 [${Type}] String 2 [Release] Case insensitive [] #### Steps to run if condition is met ##### Execute shell 命令 rm -rf ${WORKSPACE}/xcode_project rm -rf ${WORKSPACE}/builds ##### Invoke Unity3d Editor Untiy3d installation name [Unity 5.6.4p1] Editor command line arguments ``` -quit -batchmode -executeMethod LightUtility.IOSBuildEditor.JenkinsBuildIOS $channel BuildForVideo-$BuildForVideo UseFullAssets-$useFullAssets -logFile ${WORKSPACE}/Export/Editor.${JOB_NAME}.no${BUILD_NUMBER}.log ``` #### Execute shell 命令 ``` configuration="Release" scheme="Unity-iPhone" configurationBuildDir="build" configuration="Release" buildPath=${WORKSPACE}/builds if [ ! -d "$buildPath" ]; then mkdir "$buildPath" fi LogDir=${WORKSPACE}/Export if [ ! -d "$LogDir" ]; then mkdir "$LogDir" fi toolPath=${WORKSPACE}/${JOB_NAME}/JenkinsTools projectPath=${WORKSPACE}/xcode_project/Unity-iPhone.xcodeproj archivePath=${WORKSPACE}/builds/ios2.xcarchive exportPath=${WORKSPACE}/builds/Test exportOptionsPlist=$toolPath/AdHocExportOptions.plist if [ "$channel" == "SKIN_1" ]; then exportOptionsPlist=$toolPath/Skin1AdHocExportOptions.plist elif [ "$channel" == "SKIN_2" ]; then exportOptionsPlist=$toolPath/Skin2AdHocExportOptions.plist fi if [ "$Type" != "Test" ]; then exportPath="builds/Release" exportOptionsPlist=$toolPath/AppStoreExportOptions.plist if [ "$channel" == "SKIN_1" ]; then exportOptionsPlist=$toolPath/Skin1AppStoreExportOptions.plist elif [ "$channel" == "SKIN_2" ]; then exportOptionsPlist=$toolPath/Skin2AppStoreExportOptions.plist fi fi rm -rf ${exportPath} logPath=${WORKSPACE}/Export/Xcode.${JOB_NAME}.no${BUILD_NUMBER}.log if [ "$Type" == "Test" ] || [ "$Type" == "FullRelease" ]; then echo "------------------------------------------build ${Type} from the beginning" if [ "$RebuildArchive" == "true" ];then #xcodebuild clean -project "$projectPath" -configuration "$configuration" -alltargets >> $logPath xcodebuild archive -project "$projectPath" -scheme "$scheme" -configuration "$configuration" -archivePath "$archivePath" -UseModernBuildSystem=YES CONFIGURATION_BUILD_DIR="$configurationBuildDir" >> $logPath fi xcodebuild -project "$projectPath" -exportArchive -archivePath "$archivePath" -exportOptionsPlist "$exportOptionsPlist" -exportPath "$exportPath" >> $logPath else echo "--------------------------------------------build ${Type} form ios2.xcarchive" xcodebuild -project "$projectPath" -exportArchive -archivePath "$archivePath" -exportOptionsPlist "$exportOptionsPlist" -exportPath "$exportPath" >> $logPath fi if [ "$Type" != "Test" ]; then cp "$exportPath"/Unity-iPhone.ipa Export/Unity-iPhoneDistribution.ipa fi if [ -a $buildPath/Test/Apps/Unity-iPhone.ipa ]; then cp $buildPath/Test/Apps/Unity-iPhone.ipa Export/Unity-iPhone.ipa #cp $toolPath/Release.png Export/QRCode.png cp $buildPath/Test/App\ Thinning\ Size\ Report.txt Export/App\ Thinning\ Size\ Report.txt cp $toolPath/Release_public.png Export/QRCode_public.png #if [ "$Type" == "Test" ]; then #ping 123.207.255.250 -c 2 cd /Volumes/ssupdate/${JOB_NAME} cp $buildPath/Test/Apps/Unity-iPhone.ipa /Volumes/ssupdate/${JOB_NAME} #fi fi ``` #### Conditional step(single) Run? [Boolean condition] Token [${UploadTpAppstpre}] Builder [Execute shell] 命令 ``` ipaPath="builds/Release/Unity-iPhone.ipa" altoolPath="/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool" logPath=${WORKSPACE}/Export/uploadResult.${JOB_NAME}.no${BUILD_NUMBER}.xml if [ "$Type" == "Release" -a -f $ipaPath ] || [ "$Type" == "FullRelease" -a -f $ipaPath ]; then echo "Upload ipa to appStore..." /Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool --validate-app -f ${ipaPath} -u hr@igreatdream.com -p hpoi-cmmv-yvhf-pqtc -t ios --output-format xml >> $logPath /Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool --upload-app -f ${ipaPath} -u hr@igreatdream.com -p hpoi-cmmv-yvhf-pqtc -t ios --output-format xml >> $logPath fi ``` ## 构建后操作 ### Archive the artifacts 用于存档的文件 [builds/ios2.xcarchive/dSYMs/*.dSYM,builds/ios2.xcarchive/*.plist,Export/*.*] ### Set build description Regular expression [] Description [ver.${SVN_REVISION}]