美文网首页
fastlane 初探

fastlane 初探

作者: 石显军 | 来源:发表于2019-04-09 17:09 被阅读0次
fastlane

前言

fastlane是为iOS和Android应用程序自动化beta部署和发布提供最简单的方法。它可以处理所有繁琐的任务,例如生成屏幕截图,处理代码签名和发布应用程序。

今天我来尝试自动打包并发布到蒲公英、其中遇到的问题大多都可以在github官网中找到

fastlane安装

  1. 安装xcode命令行工具 xcode-select --install
    如果没有安装过会弹出对话框,点击安装。
    如果已经安装过会提示 command line tools are already installed

  2. sudo gem install fastlane -NVbrew cask install fastlane 都可以安装。
    我是使用gem安装的。

  3. 初始化fastlane:cd到项目路径下,执行fastlane init

  • [10:07:26]: Your Apple ID (e.g. fastlane@krausefx.com): 输入Apple ID
  • Password (for *Apple ID*): Apple ID 对应的密码
  • Please enter the 6 digit code: 双重认证 验证码
  • App Identifier (com.krausefx.app): APP ID

4.会生成两个文件
Appfile: 配置bundle id、Apple email address、Team ID等信息
Fastfile:配置lane

lane

Fastfile文件中可以配置多个lane,每个lane相当于一个任务,lane 由action 组成

lane :release do
  capture_screenshots                # 捕获屏幕截图
  build_app                          # 构建应用
  upload_to_app_store                # 上传至商店
  slack                              # 通知
end

capture_screenshotsbuild_appupload_to_app_storeslack就是action。

action

acton的官方文档
常用action:

  • scan:自动运行测试工具,并且可以生成HTML报告
  • match:一个新的证书和配置文件管理工具。把所有需要用到的证书传到git私有库上,任何需要配置的机器直接用match同步回来就不用管证书问题了
  • gym: fastlane中的的自动化编译工具,和其他工具配合的非常默契
  • deliver: 自动上传截图,APP的元数据,二进制(ipa)文件到iTunes Connect
  • pilot : 管理TestFlight的测试用户,上传二进制文件

根据需求自由组合,还有一些第三方的action,比如蒲公英

上传至蒲公英

官方文档

  1. 安装蒲公英插件 fastlane add_plugin pgyer
  2. 将action 添加到lane
lane :pgy do
  build_app(export_method: "ad-hoc")
  pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e")
end
  1. 执行lane
fastlane pgy

等待执行完成 就OK了

相关文章

网友评论

      本文标题:fastlane 初探

      本文链接:https://www.haomeiwen.com/subject/pyciiqtx.html