fastlane打包脚本
2018-12-18 本文已影响14人
iOSCoder_XH
Fastfile文件内容如下:
default_platform(:ios)
platform :ios do
desc "打包 命令:fastlane dev desc:xxxxx upload:pgy"
lane :dev do |option|
app_info_plist_path = "./xxxx/info.plist"
scheme_name = "xxxx"
time_string = Time.now.strftime('%Y-%m-%d_%H:%M:%S')
app_version = get_info_plist_value(path: "#{app_info_plist_path}", key: "CFBundleShortVersionString")
app_build = get_info_plist_value(path: "#{app_info_plist_path}", key: "CFBundleVersion")
app_version_build = "#{app_version}(#{app_build})"
app_ipa_name = "#{scheme_name}_#{app_version_build}_#{time_string}"
print("app_ipa_name: #{app_ipa_name}")
#打包
gym(
scheme: "#{scheme_name}",
export_method: "development",#打包所选的种类(就是App Store,生产测试,企业,开发测试那四种), app-store,ad-hoc,enterprise,development
output_directory: "./build",
output_name: "#{app_ipa_name}.ipa"
)
app_update_desc = "#{option[:desc]}"
#上传到firim或pgy
upload_type = "#{option[:upload]}"
if upload_type == "firim"
firim(
firim_api_token:"xxxxx",
app_changelog:"#{app_update_desc}"
)
end
if upload_type == "pgy"
pgyer(
api_key: "xxxxx",
user_key: "xxxxx",
update_description: "#{app_update_desc}"
)
end
clean_build_artifacts
end
end