https://www.jianshu.com/p/db5fe7fed9f3
https://blog.csdn.net/l7022995/article/details/79321924
https://www.jianshu.com/p/840943eff17b
打包脚本
# You can define as many lanes as you want
desc "Deploy a new version to the App Store"
lane :release do |op|
increment_version_number(version_number: op[:version]) #根据入参version获取app版本号
increment_build_number(build_number: op[:version]) #将build号设置与app版本号相同
# 设置app的info.plist文件项
set_info_plist_value(path: "./xxx/Info.plist", #info.plist文件目录
key: "UIFileSharingEnabled", # key,将plist文件以Source Code形式打开可查询对应的key
value: false) # value
# 设置自定义plist文件项,用于给app配置不同的服务器URL
set_info_plist_value(path: "./xxx/hostAddress.plist",
key: "host",
value: "https:/zhengshiServer:xx/xxx/xxx")
# 设置某些服务是否有效
# 还可以使用modify_services,具体参考官网相关文档
produce(
enable_services:{
push_notification: "on",
}
)
# 更新Provisioning Profile
# 在项目当前目录下创建provisions文件夹,并将App Store版本的.mobileprovision文件保存在里面,名称随意。
update_project_provisioning(profile: "./provisions/appstore.mobileprovision")
# 更新项目团队
update_project_team(path: "xxx.xcodeproj",
teamid: "5JC8GZ432G")
# 开始打包
gym(# use_legacy_build_api: true, # Xcode 9之后,需要去掉
output_name: "appstore", # 输出的ipa名称
silent: true, # 隐藏没有必要的信息
clean: true, # 在构建前先clean
configuration: "Release", # 配置为Release版本
codesigning_identity: "iPhone Distribution: xxx Co.,Ltd. (5JC8GZ432G)", # 代码签名证书
buildlog_path: "./fastlanelog", # fastlane构建ipa的日志输出目录
export_method: "app-store", # Xcode 9增加export_method标签
output_directory: "/Users/xxx/Desktop") # ipa输出目录
end
desc "Build a new version use the ceshi"
lane :ceshi do |op|
increment_version_number(version_number: op[:version])
increment_build_number(build_number: op[:version])
set_info_plist_value(path: "./xxx/Info.plist",
key: "UIFileSharingEnabled",
value: true)
set_info_plist_value(path: "./xxx/hostAddress.plist",
key: "host",
value: "https:/ceshiServer:xx/xxx/xxx")
# 设置某些服务是否有效
# 还可以使用modify_services,具体参考官网相关文档
produce(
enable_services:{
push_notification: "off",
}
)
# 将Development版本的.mobileprovision文件保存在里面,名称随意。
update_project_provisioning(profile: "./provisions/development.mobileprovision")
update_project_team(path: "xxx.xcodeproj",
teamid: "5JC8GZ432G")
gym(# use_legacy_build_api: true,
output_name: "ceshi",
silent: true,
clean: true,
configuration: "Debug",
buildlog_path: "./fastlanelog",
codesigning_identity: "iPhone Developer: xxx (xxxxxxxxxx)",
export_method: "development", # Xcode 9增加export_method标签
output_directory: "/Users/xxx/Desktop"
)
end