https://blog.csdn.net/u011656331/article/details/80708255
FastFile配置的实例:
#!/usr/bin/ruby
# -*- coding: UTF-8 -*-
# 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
#
# Uncomment the line if you want fastlane to automatically update itself
update_fastlane # 设置是否自动更新 fastlane
default_platform(:ios) # 设置默认的平台为ios
platform :ios do #针对iOS平台的配置信息
begin
last_build = get_build_number.to_i #get_build_number,获取工程中的build number
rescue
puts "No Active Build using build nr. 0"
last_build = 0
end
#scheme name,不同App需要修改
scheme_name = "FastLaneDemo"
#ipa存放路径
ipaPath = "./ipas"
desc "运行单元测试和UI测试"
lane :tests do
run_tests(scheme: scheme_name)
end
desc "打包并上传测试版至testflight"
lane :beta_testflight do
now_build = last_build.to_i + 1
#增加build
increment_build_number(build_number: now_build)
#编译App
gym(
clean: true,
scheme: scheme_name,
configuration: "Release",
export_method: "ad-hoc",
output_directory: ipaPath,
output_name: "#{scheme_name}_#{now_build}",
include_bitcode: false, #bitcode
export_options: { #指定配置文件等设置,如果在Xcode中配置好了可不传
provisioningProfiles: {
"com.bestwise.fastlane.test.archieve" => "abbecb3e-7d7f-49eb-ad6a-be12a740b8b1",
}
}
)
#上传至testFlight
upload_to_testflight(
skip_waiting_for_build_processing: true #是否跳过等待apple处理的过程
)
end
desc "打包并上传至app-store"
lane :app_store do
now_build = last_build + 1
#增加build number
increment_build_number(
build_number: now_build
)
#导出ipa包
gym(
clean: true,
scheme: scheme_name,
export_method: "app-store",
output_directory: "#{ipaPath}/release_app_store",
output_name: "#{scheme_name}_#{now_build}"
)
#上传至app-store
deliver(
force: true, #是否跳过HTML验证报告,默认false
skip_metadata: true, #是否跳过上传metadata,默认false
skip_screenshots: true #是否跳过上传屏幕截图,默认false
)
end
desc "打包并上传测试版至蒲公英"
lane :beta_pgyer do |args| #args获取传入的参数
puts args
now_build = last_build + 1
#增加build版本号
increment_build_number(build_number: now_build)
#编译并导出ipa包
gym(
clean: true,
scheme: scheme_name,
export_method: "development", #app-store、ad-hoc、development、enterprise
output_directory: ipaPath, #ipa包路径
output_name: "#{scheme_name}_#{now_build}" #ipa包名字
)
#上传至蒲公英
pgyer(
api_key: "393c8071e8072d8c029205cf7924ca5a", #ipa_key, 可在蒲公英账户下查看
user_key: "c957c712b5e22bce2a2eef4125589195", #user_key, 可在蒲公英账户下查看
update_description: args[:updateDesc] #更新描述,updateDesc为传入的参数的名字, 如:fastlane beta_pgyer updateDesc: "更新说明"
)
end
desc "上传已知的ipa包至testflight"
lane :upload_testflight do |args| #args获取传入的参数
upload_to_testflight(
ipa: args[:ipaPath], #ipa路径 ipaPath为传入的参数的名字
skip_waiting_for_build_processing: false #是否跳过等待apple 处理
)
end
end
网友评论