Jenkins + SVN + Cocoapods 实现iOS自
安装Jenkins
推荐使用命令行安装
1.安装jenkins
brew install jenkins
![](https://img.haomeiwen.com/i1362511/d343914748b88a00.png)
2.启动jenkins
jenkins
![](https://img.haomeiwen.com/i1362511/921001afd358cd59.png)
如果没安装homebrew,先安装homebrew
3.启动完成,地址为:http://localhost:8080/
配置Jenkins
admin 密码(个人感觉还是记一下比较好,在jenkins启动时候可以看到)
![](https://img.haomeiwen.com/i1362511/4925137d4f8e9277.png)
然后接下来就是安装需要的插件了,直接选择默认的就好了
进入jenkins之后还可以安装袭击需要的插件,推荐
![](https://img.haomeiwen.com/i1362511/928b4201c6a59ddb.png)
Xcode integration :用于读取Xcode中项目配置
Post-Build Script Plug-in:这个插件的功能主要是用于在build后执行相关脚本
Keychains and Provisioning Profiles Management:用于钥匙串
证书配置
1.点击 Manage Jenkins-> [Keychains and Provisioning Profiles Management] 进入如下页面
![](https://img.haomeiwen.com/i1362511/8b9298a942474009.png)
![](https://img.haomeiwen.com/i1362511/69d118ea733dc530.png)
2.点击choose File 并上传 当前登录用户的~/Library/Keychain/login.keychain文件.上传成功后会出现:
![](https://img.haomeiwen.com/i1362511/b801c5f4447a1eb1.png)
3.上传Provisioning Profiles文件,xcode的profile存放在~/Library/MobileDevice/Provisioning Profiles/中,找到你要的profile,上传
![](https://img.haomeiwen.com/i1362511/5f3a23cb2db243a0.png)
新建一个项目
1.点击左侧工具栏"新建",选择第一项"构建一个自由风格的软件项目"
![](https://img.haomeiwen.com/i1362511/18c782d841cdceaf.png)
2.基本配置
![](https://img.haomeiwen.com/i1362511/a222362507c80fd0.png)
3.源码管理(这里使用SVN)
![](https://img.haomeiwen.com/i1362511/619c69aa51bc62e0.png)
4.定时打包
![](https://img.haomeiwen.com/i1362511/58e896bc0c7849cc.png)
5.执行Cocoapods 更新脚本
![](https://img.haomeiwen.com/i1362511/1ee0eac39458fa3d.png)
6.读取Xcode 设置
![](https://img.haomeiwen.com/i1362511/97fb35757922f86b.png)
![](https://img.haomeiwen.com/i1362511/2f87acd550bbd204.png)
![](https://img.haomeiwen.com/i1362511/872861308110dbd8.png)
7.保存配置之后,去构建自己的项目
![](https://img.haomeiwen.com/i1362511/cc9440c625c309c6.png)
8.通过Console output查看日志,也可以从中查找错误
![](https://img.haomeiwen.com/i1362511/4e786e6f084e802e.png)
9.出现success的标志就意味着打包成功了,可以根据显示的路径4查看打出的ipa文件
![](https://img.haomeiwen.com/i1362511/1d8d939b4e30c3a9.png)
10.构建过程中如果提示ResourceRules.plist的错误需要在xcode工程里添加$(SDKROOT)/ResourceRules.plist
![](https://img.haomeiwen.com/i1362511/5753ae74823f4b99.png)