最牛X的iOS、安卓自动打包管理工具,没有之一,The easiest way to build and release mobile apps.
安装前的准备工作
1.Ruby环境
2.Xcode
安装fastlane
# Using RubyGemssudo gem install fastlane -NV
//或者
# Alternatively using Homebrewbrew cask install fastlane
使用fastlane
1. cd + 项目目录
2. fastlane init ,我的是之前安装过,需要升级四个选项: 1.自动截屏 2.自动发布TestFlight 3.自动发布AppStore 4.手动设置 我们测试 选择4,此时项目中会出现一个fastlane文件夹和两个文件如图:
Appfile# app_identifier("[[APP_IDENTIFIER]]") # The bundle identifier of your app
# apple_id("[[APPLE_ID]]") # Your Apple email address
# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
Fastfile
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
platform :ios do
desc "Description of what the lane does"
lane :custom_lane do
# add actions here: https://docs.fastlane.tools/actions
end
end
这些是Ruby代码,和CocoaPods内代码类似:
- customers_lane是函数名称,打包的执行命令的时候使用
- actions是扩展,可以自己写插件、命令等操作用于打包
写命令
default_platform(:ios)
platform :ios do
desc "Description of what the lane does"
lane :veronica do
version = get_version_number
ipaName = "veronica_#{version}.ipa"
gym(
scheme:"veronica",
export_method:"development",
configuration:"Release",
output_name:"#{ipaName}",
output_directory:"./build"
)
end
end
开始打包
打包结束 用时三分钟 打包成功上传到fir.im
-
cd到项目目录下,安装fir的插件,执行命令
fastlane add_plugin firim
-
编写Fastfile文件,添加firim相关代码
default_platform(:ios) platform :ios do desc "Description of what the lane does" lane :veronica do version = get_version_number ipaName = "veronica_#{version}.ipa" firim_api_token="*********************" gym( scheme:"veronica", export_method:"development", configuration:"Release", output_name:"#{ipaName}", output_directory:"./build" ) firim(firim_api_token:"#{firim_api_token}") end end
-
cd到项目目录下,执行命令:
fastlane veronica
-
打包上传成功
未完待续
参考链接: