iOS自动化测试赏味不足iOS Developer

Fastlane - 利用Fastfile脚本打包

2016-12-01  本文已影响273人  沈宥

发现直接利用gym命令行打包过于麻烦,直接编写了脚本执行:

default_platform :ios
platform :ios do
    before_all do
    git_pull
end

#打包配置
#版本号
version = get_version_number(xcodeproj: "Project.xcodeproj")
#build number自动加1
build_number = increment_build_number
plist_path = "./Info.plist"
set_info_plist_value(path: "#{plist_path}", key: "CFBundleVersion", value: "#{build_number}")
#打包时间记录
time = Time.new
timeString = time.strftime("%Y-%m-%d_%H:%M:%S")
project_path = "Project根目录"
workspace = "#{project_path}/your workspace.xcworkspace"
output_directory = "#{project_path}/APP"
output_name = "#{version}_#{build_number}_#{timeString}.ipa"

lane :release do
gym(
workspace: "#{workspace}",
configuration: "Release",
scheme: "Scheme Name",
export_method: "ad-hoc",
clean: true,
# Destination directory. Defaults to current directory.
output_directory: "#{output_directory}",

# specify the name of the .ipa file to generate (including file extension)
output_name: "day_inke_release_#{output_name}",     
silent: false,
include_symbols: true,
use_legacy_build_api: true
)

#上传到fir.im
system "fir publish #{output_directory}/day_inke_release_#{output_name} -T Your TokenId "
end
end

备注:注意脚本中斜体部分,修改为自己的配置。
cd到工程根目录下,运行命令为:fastlane release
静待出包(注意,打包前,工程的证书设置一定要正确)

上一篇下一篇

猜你喜欢

热点阅读