一、iOS项目fastlane配置
1、fastlane init
会有如下询问,依照提问填写就行
1、Select Scheme:(选择工作区间)
- 选择你的工作区间即可
2、Would you like to create your app on iTunes Connect and the
Developer Portal?(你想在iTunes Connect上创建你的应用程序吗开发人员门户?)
- y
3、Do you want to setup 'deliver', which is used to upload app
screenshots, app metadata and app updates to the App Store? This requires the app to be in the App Store already(你想设置“交付”,它是用来上传app的吗屏幕截图,应用程序元数据和应用程序更新到app Store?这需要应用程序在App Store里):
- y
4、Optional: The scheme name of your app (If you don't need one, just
hit Enter):(可选:你的应用程序的名称(如果你不需要,只是回车):)
- enter
2、执行完上面步骤,会在当前目录生成一个fastlane目录,目录结构如下
fastlane目录结构.png
3、部署公测环境,添加firim插件,实现打包成功ipa后自动上传firim
fastlane add_plugin firim
添加firim插件的时候,会有如下提问:
1、Should fastlane modify the Gemfile at path 'Gemfile' for you?
(fastlane是否应该在path 'Gemfile '上修改Gemfile ?):y
4、配置fastlane文件
# 工程名
$project_name = "test"
# 工程名缩写
$project_abbreviation = "test"
# plist文件的路径
$info_plist_path = "./test/Info.plist"
# firim api token
$firim_api_tokne = ""
# firim的短连接
$firim_short = "test"
fastlane_version "2.68.2"
default_platform :ios
platform :ios do
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
# cocoapods
# carthage
end
# 发布到firim的测试包
lane :to_firim do |options|
# 先获取当前项目中的bundle version + 1
@build_version = get_info_plist_value(path: "#{$info_plist_path}", key: "CFBundleVersion").to_i + 1
# 针对于 iOS 项目开发证书和 Provision file 的下载工具
sigh(
development: true,# 配置证书类型,支持adhoc,development,force
output_path: "./fastlane/crets"# 证书保存的路径
)
# 设置 bundle version
set_info_plist_value(
path: "./so/Supporting Files/so-Info.plist",
key: "CFBundleVersion",
value: "#{@build_version}"
)
# 针对于 iOS 编译打包生成 ipa 文件
gym(
workspace: "#{$project_name}.xcworkspace",# 工作区
scheme: "#{$project_name}",# 工程名
clean: true,# archive前先clean一下
configuration: "Debug",# 打debug包,默认为:'Release'
export_method: "development",# 导出存档的方法,支持app-store, ad-hoc, package, enterprise, development, developer-id
output_directory: "ipa_build/debug",# 输出ipa的路径
output_name: "#{$project_abbreviation}"# 输出ipa的名字
)
# 发布到firim
firim(
firim_api_token: "#{$firim_api_tokne}",# api_token
app_short: "#{$firim_short}",# 短连接
app_changelog: options[:update_log]# 更新说明
)
end
# 发布到appstore
lane :to_appstore do
# 先获取当前项目中的bundle version + 1
@build_version = get_info_plist_value(path: "#{$info_plist_path}", key: "CFBundleVersion").to_i + 1
# 针对于 iOS 项目开发证书和 Provision file 的下载工具
sigh(
force: true,
output_path: "./fastlane/crets"
)
# 设置 bundle version
set_info_plist_value(
path: "./so/Supporting Files/so-Info.plist",
key: "CFBundleVersion",
value: "#{@build_version}"
)
# 针对于 iOS 编译打包生成 ipa 文件
gym(
workspace: "#{$project_name}.xcworkspace",
scheme: "#{$project_name}",
clean: true,
configuration: "Release",
export_method: "app-store",
output_directory: "ipa_build/release",
output_name: "#{$project_abbreviation}"
)
# 用于上传应用的二进制代码,应用截屏和元数据到 App Store
deliver(
force: true,# 上传之前是否成html报告
submit_for_review: false,# 上传后自动提交审核
automatic_release: true,# 通过审后自动发布
skip_binary_upload: false,# 跳过上传二进制文件
skip_screenshots: true,# 是否跳过上传截图
skip_metadata: false,# 是否跳过元数据
)
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
5、完成上面步骤之后,执行下面命令进行部署打包
fastlane to_firim update_log:更新说明
执行成功后,可以在fir上面查看app是否已上传,同时会在项目根目录生成一个ipa_build
文件夹,里面有dubug和release两个文件夹,分别存放着对应的ipa
文件
二、Android项目fastlane配置
1、fastlane init
会有如下询问,依照提问填写就行
1、Do you have everything committed in version control? If not please
do so now!(是否已经将所有内容提交到版本控制了,如果没有尽快完成),
- y
2、Package Name (com.krausefx.app):
- 输入你项目的包名即可
3、Follow the Setup Guide on how to get the Json file: https://github.com/fastlane/fastlane/tree/master/supply#setup,Path to the json secret file:
(按照安装指南如何得到Json文件:https://github.com/fastlane/fastlane/tree/master/supply设置中,路径Json秘密文件:):
- 可以按enter键跳过
4、Do you plan on uploading metadata, screenshots and builds to Google
Play using fastlane?(是否上传Meta信息,截屏等到Google Play)
- n
2、执行完上面步骤,会在当前目录生成一个fastlane目录,目录结构如下
fastlane目录结构.png
3、配置fastlane文件
fastlane_version "2.68.2"
default_platform :android
platform :android do
before_all do
# ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
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
lane :to_debug do
gradle(
task: "assemble",
build_type: "Debug"
)
end
lane :to_release do
# 配置打包环境
gradle(
task: "assemble",
build_type: "Release",
properties: {
"android.injected.signing.store.file" => "./fastlane/crets/gltc_keystore.jks",
"android.injected.signing.store.password" => "123456",
"android.injected.signing.key.alias" => "gltc",
"android.injected.signing.key.password" => "123456",
}
)
end
end
网友评论