Fastlane 自動構(gòu)建
注解: 本文主要圍繞 iOS 自動編譯打包發(fā)布蒲公英配置, &&,在 終端 如何使用命令
1. 目錄: fastlane/Fastfile
lane :beta do
time = Time.new.strftime("%Y%m%d") #獲取時間格式
version = get_version_number #獲取版本號
ipaName = "Release_#{version}_#{time}.ipa" # 輸出后的ipa的名字
gym(
scheme:"Optimus", #項目名稱
export_method:"enterprise", #打包的類型
configuration:"Release", #模式,默認Release,還有Debug
output_name:"#{ipaName}", #輸出的包名
output_directory:"~/Desktop" #輸出的位置
)
pgyer(
api_key: "cxxxxe",
user_key: "6xxxxc",
update_description: "歩羨仙 with MBP in #{time}"
)
end
2. 命令使用: fastlane beta
打開終端, 并在app所在目錄(以 app-ios 為文件目錄舉例)輸入, 按回車鍵即可)
mac@mbp app-ios % fastlane beta
來一個分隔符吧
畢竟
高潮要來了
3. 花里胡哨
因為最近自動構(gòu)建報Net::ReadTimeout with #<TCPSocket:(closed)> ;
(雖然報異常,但是打包且發(fā)布到pgyer平臺正常)
分析: 使用新創(chuàng)建的項目打包則沒有報異常, 可能因為包本身大小過大,以及網(wǎng)絡(luò)上傳限制 ;
結(jié)論: 使用 curl 命令替換;
改進版 curl命令 sh腳本方式
lane :beta do
time = Time.new.strftime("%Y%m%d") #獲取時間格式
version = get_version_number #獲取版本號
ipaName = "Release_#{version}_#{time}.ipa" # 輸出后的ipa的名字
gym(
scheme:"Optimus", #項目名稱
export_method:"enterprise", #打包的類型
configuration:"Release", #模式,默認Release,還有Debug
output_name:"#{ipaName}", #輸出的包名
output_directory:"~/Desktop" #輸出的位置
)
sh "curl -F 'file=@pathto/app.ipa' -F 'uKey=userkey in pgyer ' -F '_api_key=apikey in pgyer' http://www.pgyer.com/apiv1/app/upload -F 'updateDescription=test update by 歩羨仙'"
end