IOS Shell Script Package

Source: Internet
Author: User

Original link: Http://www.jianshu.com/p/5abbe0d61cef

Reference Link: http://blog.csdn.net/potato512/article/details/52176073

Beginning

The first few pieces recorded the use of Jenkins, configure a Jenkins environment, we need a relatively busy notebook to do this job, it is impossible to own the Ben has been open this service, the CPU fan turn wildly, other performance decline, but will affect our work, how to do, Write a shell script to help us complete the project package, upload.

Principle

Xcode compiling in Jenkins, Shell compilation, or Xcode compiling itself requires Xcode's own IDE environment, specifically

xcodebuild & xcrun这俩家伙来完成

Not much nonsense to say, directly on the script, need to change their own can.

Project Package Upload
#!/usr/bin/bash#next Test#1. Certificates#2. Packaging status per judgmentThe value of #设置Xcode的Build settings->code Signing Resource Rules path is: $ (sdkroot)/resourcerules.plist#xcodeproj文件的绝对路径PROJECT ="/users/mac/desktop/pro/git/mcpaydemo/mcpaydemo.xcodeproj" scheme="Mcpaydemo"#iPhone distribution:identity="IPhone Developer:ma Jiancheng (xxxxx)"#Distribution Provision File pathprovisioning_profile="/users/mac/library/mobiledevice/provisioning\ profiles/ead3e7e7-a2e8-45c2-98fa-008f3712xxxx.mobileprovision"#输出ipa文件的路径, preferably an absolute path outdir="/users/mac/desktop/pro/git/mcpaydemo/output" productdir=${outdir}#FIR secret key firtoken="5558b26ae383df7390b880xxxxxxx"#蒲公英aipKeyPAPIKEY ="C1ad57c15a5bb0c770c51639xxxxxxx"#蒲公英uKeyPUKEY ="D5eb8f86040b9ae6108ed4c58xxxxxxx"if [!-F$PROVISIONING _profile];ThenEcho"Download the provision file for"${provisioning_profile}Exit4;FiEcho"~~~~~~~~~~~~~~~~ Cleanup project ~~~~~~~~~~~~~~~~ compiling project ~~~~~~~"Echo"${outdir}${scheme}.ipa "Echo"Xcrun-sdk Iphoneos packageapplication-v${productdir}/${scheme}.app-o${outdir}/${scheme}.ipa--sign${identity}--embed${provisioning_profile} "Xcodebuild-project"${project} "-scheme"${scheme} "-configuration Release clean Build code_sign_identity="${identity} "-sdk Iphoneos configuration_build_dir=${outdir}#打包成. IPAEcho"~~~~~~~~~~~${scheme}.ipa}~~~scuess "Echo"Xcrun-sdk Iphoneos packageapplication-v${productdir}/${scheme}.app-o${outdir}/${scheme}.ipa--sign \ "${identity}\ "--embed${provisioning_profile} "Xcrun-sdk Iphoneos packageapplication-v"${productdir}/${scheme}.app "-O"${outdir}/${scheme}.ipa "#--sign "\" ${identity}\ ""--embed "${provisioning_profile}"#上传到测试平台-Fir.imfir P"${outdir}/${scheme}.ipa "-t"${firtoken} "echo "-------------------->fir.im-------> Dandelion---------"echo "curl-f [email protected]${ outdir}/${scheme}.ipa-f ukey=${pukey}-F _api_key=${papikey} http://www.pgyer.com/apiv1/app/upload " Curl-f "[email protected]${outdir}/${scheme}.ipa"-F "ukey=${pukey}"-F "_api_key=$ {Papikey} " " Http://www.pgyer.com/apiv1/app/upload "echo " \ n      " 
Workspace Package Upload
/#!/usr/bin/bash#############################################/# Batch Rename #/# Input: SCHEME #/# eg: scheme #/to be compiled# Input: $ provision PREFIX #/# eg:mobileprovision File name ###############################################next Test#1. Certificates#2. Packaging status per judgmentThe value of #设置Xcode的Build settings->code Signing Resource Rules path is: $ (sdkroot)/resourcerules.plist#xcodeproj文件的绝对路径 [Modify]workspace_path="/users/mac/desktop/car/runnor.carservice.iosapp/" workspace_name="Mccarserviceiphone" scheme="Mccarserviceiphone"#生成的APP名称, according to the Xcode project Plist appname="Mccarserviceiphone"#iPhone Distribution:foo. identity="\" IPhone developer:ma Jiancheng (xxxxxxxxx) \ ""#Distribution Provision File pathprovisioning_profile="/users/mac/library/mobiledevice/provisioning\ profiles/ead3e7e7-a2e8-45c2-98fa-008f3712382d.mobileprovision"#输出ipa文件的路径, preferably an absolute path outdir="${workspace_path}/output "#FIR secret key firtoken="5558b26ae383df7390b880bexxxxxxx"#蒲公英aipKeyPAPIKEY ="C1ad57c15a5bb0c770c51639xxxxxxx"#蒲公英uKeyPUKEY ="D5eb8f86040b9ae6108ed4c5xxxxxxxx"if [!-F$PROVISIONING _profile];ThenEcho"Download the provision file for"${provisioning_profile}Exit4;FiEcho"~~~~~~~~~~~~~~~~ Cleanup project ~~~~~~~~~~~~~~~~ compiling project ~~~~~~~"Echo"${outdir}${appname}.ipa "Echo"Xcodebuild-workspace${workspace_name}.xcworkspace-scheme${scheme}-configuration Release Clean build code_sign_identity=${identity}-sdk Iphoneos configuration_build_dir=${outdir} "Xcodebuild-workspace"${workspace_path}/${workspace_name}.xcworkspace "-scheme"${scheme} "-configuration Release clean Build code_sign_identity="${identity} "-sdk Iphoneos configuration_build_dir=${outdir}#打包成. IPAEcho"~~~~~~~~~~~${appname}.ipa}~~~scuess "Echo"Xcrun-sdk Iphoneos packageapplication-v${outdir}/${appname}.app-o${outdir}/${appname}.ipa--sign${identity}--embed${provisioning_profile} "Xcrun-sdk Iphoneos packageapplication-v"${outdir}/${appname}.app "-O"${outdir}/${appname}.ipa "#--sign "${identity}"--embed "${provisioning_profile}"Fir.im, #上传到测试平台Echo"-------------------->fir.im-------> Dandelion---------"#fir P "${outdir}/${scheme}.ipa"-T "${firtoken}"#, Dandelion echo "curl-f [email protected]${outdir}/${appname}.ipa-f ukey=${pukey}-F _api_key= ${papikey} http://www.pgyer.com/apiv1/app/upload "Curl-f " [email protected]${outdir}/${appname}. IPA "-F " ukey=${pukey} "-F " _api_key=${papikey} " " Http://www.pgyer.com/apiv1/app/upload " echo "\ n"#--------------------End--------------         
Conclusion

This shell statement is relatively simple to write, and will be optimized in this article for leisure. This article is a derivative of Jenkins, and will follow up on Jenkins to explore some of the work that continues to build .



Wen/lp_ Ma Jiancheng (Jane book author)
Original link: Http://www.jianshu.com/p/5abbe0d61cef
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".

IOS Shell Script Package

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.