是什么 ? | : | a command-line tool for iOS and Android developers to automate tedious tasks like generating screenshots, dealing with provisioning profiles, and releasing your application. |
开发语言 | : | Ruby |
官方主页 | : | https://fastlane.tools |
源码仓库 | : | https://github.com/fastlane/fastlane |
step1、通过HomeBrew安装
brew install fastlane
step2、配置PATH
环境变量
export PATH=~/.fastlane/bin:$PATH
fastlane
命令的使用格式:
fastlane [global-option]...
fastlane [global-option]... <sub-command> [sub-command-option]...
fastlane [global-option]... <laneName>
查看fastlane
命令的帮助信息。
查看fastlane
的版本信息。
查看sub-command
的使用帮助。
此命令等同于fastlane sub-command --help
在项目的根目录下,执行此命令,用来创建必要的配置信息。
上面的过程是交互的,在要求进行自动化的环境中不适合。
对于Apple ID
,可以以-u APPLE_ID
参数传入。
对于密码,以环境变量FASTLANE_PASSWORD
的形式保存。
对于验证码,可以关闭验证码的二次验证。
此命令执行完毕后,会在项目根目录下生成一个文件夹,叫做fastlane
,里面生成了两个Ruby语法的文件:Appfile
和Fastfile
。
./fastlane/Appfile
记录的是一些项目的元数据,其内容如下:
app_identifier "com.fpliu.newton" # The bundle identifier of your app
apple_id "792793182@qq.com" # Your Apple email address
team_id "NWLTN55N9S" # Developer Portal Team ID
# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md
./fastlane/Fastfile
就是类似于其他构建工具的核心配置文件,这是我们频繁修改的文件,其内容如下:
# Customise this file, documentation can be found here:
# https://docs.fastlane.tools/actions/
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
# update_fastlane
# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.61.0"
default_platform :ios
platform :ios do
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
cocoapods
# carthage
end
desc "Runs all the tests"
lane :test do
scan
end
desc "Submit a new Beta Build to Apple TestFlight"
desc "This will also make sure the profile is up to date"
lane :beta do
# match(type: "appstore") # more information: https://codesigning.guide
gym # Build your app - more options available
pilot
# sh "your_script.sh"
# You can also use other beta testing services here (run `fastlane actions`)
end
desc "Deploy a new version to the App Store"
lane :release do
# match(type: "appstore")
# snapshot
gym # Build your app - more options available
deliver(force: true)
# frameit
end
# You can define as many lanes as you want
after_all do |lane|
# This block is called, only if the executed lane was successful
# slack(
# message: "Successfully deployed new App Update."
# )
end
error do |lane, exception|
# slack(
# message: exception.message,
# success: false
# )
end
end
# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://docs.fastlane.tools/actions
# fastlane reports which actions are used. No personal data is recorded.
# Learn more at https://github.com/fastlane/fastlane#metrics
这里面定义了一些lane
,lane
就相当于Ant、gradle等构建工具中的任务的概念。
这些lane
可以通过fastlane
命令直接执行,形如:fastlane lane
。
显示该工程中的所有lane
,包含每个lane
的详细描述。
这些lane
定义在./fastlane/Fastfile
中。
显示该工程中的所有lane
,不包含每个lane
的详细描述。
这些lane
定义在./fastlane/Fastfile
中。
显示支持的所有的action
。目前大约有200
来个。
显示指定的action
的详细帮助信息。
直接运行指定的action
,而不需要通过定义lane
。
打印环境信息。当您出现问题的时候,想要在GitHub上提交您的环境信息,使用此命令即可, 他会把这些信息自动复制到剪贴板,您只需要把这些信息粘贴上去即可。