Fastlane 安装文档:https://docs.fastlane.tools/getting-started/ios/setup/
Installing fastlane
Make sure you have the latest version of the Xcode command line tools installed:
xcode-select --install
Install fastlane using
[sudo] gem install fastlane -NV
or alternatively using brew cask install fastlane
Navigate to your project directory and run
fastlane init
Setting up fastlane
Navigate your terminal to your project's directory and run
for Ruby setup:
fastlane init
for Swift setup:
fastlane init swift
安装Fastlane插件
fastlane add_plugin versioning
fastlane add_plugin firim
编辑Fastfile文件
default_platform(:ios)
platform :ios do
desc "Push a new release build to the App Store"
lane :release do
# 不带adhoc参数,sigh会自动生成App Store证书(公司或个人帐户)
sigh
# 指定输出目录
gym(
output_directory: './build',
clean: true,
)
# 上传所有信息到App Store
deliver(
force: true,
skip_screenshots: true,
submit_for_review: true,
)
end
desc "Debug方式打包后上传到fir"
lane :to_firim do
# 如果你用 pod install
# cocoapods
# 如果你没有申请adhoc证书,sigh会自动帮你申请,并且添加到Xcode里
#sigh(adhoc: true)
# 以下两个action来自fastlane-plugin-versioning,
# 第一个递增 Build,第二个设定Version。
# 如果你有多个target,就必须指定target的值,否则它会直接找找到的第一个plist修改
# 在这里我建议每一个打的包的Build都要不一样,这样crash了拿到日志,可以对应到ipa上
#increment_build_number_in_plist(target: "XXXXX")
#increment_version_number_in_plist(
# target: "XXXXX",
# version_number: '1.9.0'
# )
# gym用来编译ipa
gym(
output_directory: './firim',
# clean: true,
silent: true,
export_options: {
method: "ad-hoc", # 指定打包方式
configuration: "Debug",
teamID: "teamID",
include_bitcode: false
},
scheme: "noerden_ios"
)
# 上传ipa到fir.im服务器,在fir.im获取firim_api_token
firim(firim_api_token: "firim_api_token")
end
end
使用
终端切换到项目根目录,执行Fastfile中的action。
未完待续。。。