Fastlane自动打包配置
30 December 2020
Fastlane自动打包配置
Fastlane自动打包配置,主要是编辑Fastfile,下面给一个简单的示例,代码如下:
default_platform(:ios)
platform :ios do
desc "Description of what the lane does"
lane :custom_lane do
# add actions here: https://docs.fastlane.tools/actions
end
# source "https://gems-china.org"
lane :buildApp do
# # 解决在xcode11下获取版本号问题
# # 首先要在Gemfile里添加:gem "xcodeproj"
# project_version = get_version_number(xcodeproj: "xxxx.xcodeproj", target: "xxxx")
# project = Xcodeproj::Project.open('../xxxx.xcodeproj')
# target = project.targets.first
# if project_version !~ /\d+\./
# target.build_configurations.each do |configuration|
# project_version = configuration.build_settings["MARKETING_VERSION"]
# end
# end
# # 使用cocoapods要在Gemfile添加依赖:gem 'cocoapods'
# cocoapods( clean: true, podfile: "./Podfile")
gym(
# workspace: 'HelloApp.xcworkspace',
scheme: 'HelloApp',
# codesigning_identity:'iPhone Developer: Wei Luo (Q5EST84F4F)',
export_method:'development',
configuration: 'Debug'
)
end
lane :buildApp2 do
# 安装cocoapods依赖
cocoapods( clean: true, podfile: "./Podfile")
# 打包使用gym 或 build_app 两种方式都可以
# gym(
build_app(
# workspace: 'MyWallPaper.xcworkspace',
scheme: 'MyWallPaper',
# codesigning_identity:'iPhone Developer: Wei Luo (Q5EST84F4F)',
export_method:'development',
configuration: 'Debug',
export_options: {iCloudContainerEnvironment: 'Development'}
)
# 添加pgyer插件,终端到当前项目目录执行:fastlane add_plugin pgyer
pgyer(api_key: "33axxxxxxxxx33de", user_key: "c141xxxxxxxxxx229")
end
end