fastlane--Packaging
- 自动化打包,通过fastlane自动发布
Fastlane安装不在这里详细罗列,参照一下链接流程
- https://www.jianshu.com/p/0a113f754c09
操作步骤
1.检查Fastlane是否正确安装。输入以下命令:
fastlane --version
复制代码
可以看到Fastlane版本信息,我的是fastlane 2.84.0
2.打开终端,进入你的项目工程的根目录,输入以下命令
cd到你项目的目录,执行命令
fastlane init
复制代码
- bundl update ---下面这一步可能时间较长
2.蒲公英的Fastlane插件安装
打开终端,进入你的项目工程的根目录,输入以下命令:
fastlane add_plugin pgyer
复制代码
- 这里执行完就可以了
3.配置Appfile和Fastfile文件 --这里手动配置,直接复制代码就可以了,把里面的配置改成自己的项目
Appfile文件代码如下:
#--发布蒲公英上的版本配置for_lane :pgy doapp_identifier "com.zidongdabao.cn" # The bundle identifier of your appapple_id "lu287929070@163.com" # Your Apple email address
end复制代码
Fastfile文件文件代码如下:
# 定义打包平台
default_platform :iosplatform :ios dobefore_all dogit_pulllast_git_commitsh "rm -f ./Podfile.lock"cocoapods(use_bundle_exec: false)end# 运行所有的测试lane :test doscan
end# 提交一个新的Beta版本
# 确保配置文件是最新的
lane :beta dogym pilot
end# 将新版本部署到应用程序商店
lane :release dogym deliver(force: true)
end# 以下是发布版本的配置lane :pgy dosigh(app_identifier: "com.zidongdabao.cn" #项目的bundle identifler)# 开始打包
gym(scheme: “Fastlane--Packaging”, #指定项目的scheme名称configuration: "Release", # 指定打包方式,Release 或者 Debugsilent: true, # 隐藏没有必要的信息clean: true, # 是否清空以前的编译信息 true:是workspace: "Fastlane--Packaging.xcworkspace",include_bitcode: false, #项目中的bitcode 设置output_directory: './pgy', # 指定输出文件夹output_name: "Fastlane--Packaging.ipa", #输出的ipa名称export_xcargs: "-allowProvisioningUpdates”, #忽略文件)# 开始上传蒲公英
pgyer(api_key: "1303c11160b475cc56b9d5df820a17ed", user_key: "dd705842c35567b3f2620e6a047024f0")endend复制代码
- pgyer(api_key: "1303c11160b475cc56b9d5df820a17ed", user_key: "dd705842c35567b3f2620e6a047024f0"), 在蒲谷英开发平台配置中查看
4.在终端执行自动打包
在终端输入
fastlane pgy
复制代码
一些报错处理:
打包发布成功如下:
AppStore版本的操作和上面流程一样,把Appfile和Fastfile文件修改成发布版本的配置
fatlane --命令说明
* scan -- 自动运行测试工具,并且可以生成漂亮的HTML报告
- cert -- 自动创建管理iOS代码签名证书
* sigh -- 一声叹息啊,这么多年和Provisioning Profile战斗过无数次。总是有这样那样的问题导致配置文件过期或者失效。sigh是用来创建、更新、下载、 修复Provisioning Profile的工具。
- pem -- 自动生成、更新推送配置文件
* match -- 一个新的证书和配置文件管理工具。我会另写一篇文章专门介绍这个工具。他会所有需要用到的证书传到git私有库上,任何需要配置的机器直接用match同步回来就不用管证书问题了,小团队福音啊! * gym -- Fastlane家族的自动化编译工具,和其他工具配合的非常默契
- produce -- 如果你的产品还没在iTunes Connect(iTC)或者Apple Developer Center(ADC)建立,produce可以自动帮你完成这些工作
* deliver -- 自动上传截图,APP的元数据,二进制(ipa)文件到iTunes Connect
- pilot -- 管理TestFlight的测试用户,上传二进制文件
github地址:
https://github.com/MrLujh/Fastlane--Packaging