快速安裝brew環(huán)境(https://brew.idayer.com/)
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
安裝fastlane(https://www.pgyer.com/doc/view/fastlane)
記得cd到工程目錄下? fastlane add_plugin pgyer
default_platform(:ios)
#公共設(shè)置宏定義
SCHEME = "ProjectName"? #項目名稱
EXPORT_METHOD = "development"? #ad-hoc development enterprise
OUTPUT_PREFIX = "name"? ? ? #包名前綴
OUTPUT_DIR = "/Users/fx/Desktop/fastlaneBuild"? ? ? ? #打包輸出目錄
#蒲公英
APP_KEY = "appkey"
USER_KEY = "appkey"
platform :ios do
? #測試環(huán)境
? lane :test do
? ? gym(
? ? ? scheme: "#{SCHEME}",
? ? ? export_method:"#{EXPORT_METHOD}",
? ? ? output_name:"#{OUTPUT_PREFIX}.ipa",
? ? ? output_directory:"#{OUTPUT_DIR}",
? ? ? configuration: "Debug",
? ? )
? ? pgyer(api_key: "#{APP_KEY}")
? end
? #生產(chǎn)環(huán)境
? lane :release do
? ? gym(
? ? ? scheme: "#{SCHEME}",
? ? ? export_method:"#{EXPORT_METHOD}",
? ? ? output_name:"#{OUTPUT_PREFIX}.ipa",
? ? ? output_directory:"#{OUTPUT_DIR}",
? ? ? configuration:"Release",
? ? )
? ? pgyer(api_key: "#{APP_KEY}", user_key: "#{USER_KEY}")
? end
end