iOS使用fastlane自动化打包
这两天工作安排比较松,想着做点什么,翻看到一篇文章说自动化打包的,初试了fastlane一下,果然好用,于是记录下来。
1、首先确认是否安装了ruby,终端查看下ruby版本
ruby -v
2、确认是否安装了Xcode命令行工具
xcode-select --install 或者 brew cask install fastlane

3.命令安装
sudo gem install fastlane -NV

那么需要更换源
查看源: gem sources
删除源: gem sources --remove https://gems.ruby-china.org/
更换源: gem sources -a https://gems.ruby-china.com
继续执行 sudo gem install fastlane -NV,如果如下

4.使用
cd到项目目录 fastlane init


如果出现下面的图,在操作一遍

结束进程ctrl +c;
删除项目下的fastlane文件夹;
使用gem cleanup清理一下;
重新cd到项目下执行fastlane init。
5.配置
我们项目下fastlane 有两个文件Appfile和Fastfile


app_identifier用于指定APP的bundle id,apple_id指的是你的AppleID

lane :custom_lane do中的custom_lane是函数的名称,打包执行命令的时候使用。
# add actions here: https://docs.fastlane.tools/actions 这块就是让我们加具体执行的插件、命令等操作用于打包。
简单打包用于测试,可打包成ad-hoc 或者development

6.执行打包命令
cd到项目目录,fastlane NonTeacher
7.上传到蒲公英
cd到项目下, 安装pgyer插件 执行命令
fastlane add_plugin pgyer

重新编写项目目录下的Fastfile文件,如下:

cd 到项目下,执行命令fastlane NonTeacher

因为只频繁用到了打包上传到蒲公英,所以只了解了以上信息,深入请参考下面楼主,感谢分享!
参考:https://www.jianshu.com/p/c09097211cd4
参考:https://mp.weixin.qq.com/s/mRLfF8T8JoIFbr5TiJDzpw