xcode-select --install
複製代碼
# Using RubyGems
sudo gem install fastlane -NV
# Alternatively using Homebrew
brew install fastlane
複製代碼
//執行完這條,你的項目就會有fastlane的幾個文件,具體有什麼文件,看初始化時的配置
fastlane init
// swift項目使用這條
fastlane init swift
複製代碼
方式1:使用match自動管理ios
方式2:使用cert和sigh方法git
手動管理簽名的參考配置-推薦github
// 官方配置參考
lane :beta do
build_app(
export_method: "app-store",
export_options: {
provisioningProfiles: {
"com.example.bundleid" => "Provisioning Profile Name",
"com.example.bundleid2" => "Provisioning Profile Name 2"
}
}
)
end
// 本身配置,這裏的xbb_dev是證書的名字
// 注意:export_method須要和證書相對應,若是是開發的模式,那麼使用開發的證書;若是是appstore的,就須要使用appstore的證書;若是是ad-hoc的,就須要使用ad-hoc的證書。
lane :beta do
build_app(
export_method: "app-store",
export_options: {
provisioningProfiles: {
"com.xbks.test" => "xbks test dis"
}
}
)
end
複製代碼
lane :beta do
build_app(export_xcargs: "-allowProvisioningUpdates")
end
複製代碼
lane :beta do
build_app(
scheme: "qmuidemo",
export_method: "app-store",
export_options: {
provisioningProfiles: {
"com.xbks.test" => "xbks test dis"
}
}
)
end
複製代碼
// 安裝蒲公英
fastlane add_plugin pgyer
複製代碼
// 有這些導出的類型,須要有相應的證書配對才能導出成功ipa。
// app-store, ad-hoc, package, enterprise, development, developer-id
export_method:"development"
// 若是要使用ad-hoc打包, 則需打開此項配置
sigh(adhoc:true)
// 導出的ipa名字
output_name: ouput_name
// 導出的ipa位置
output_directory: '/Users/coderiding/Downloads/Temp'
//
scheme: "xbb"
// 可省略
workspace: "xbb.xcworkspace"
// 若是使用自動簽名,須要配置這句
export_xcargs: "-allowProvisioningUpdates"
//
export_options: {}
// 是否清空上次打包信息
clean: true
// 配置開發模式仍是發佈模式:Debug or Release
configuration: "Debug"
複製代碼
// 打包命令
fastlane releaseDev descprition:" 優化代碼塊xx"
// 若是要使用ad-hoc打包, 則需打開此項配置
sigh(adhoc:true)
Time.new.strftime("%Y%m%d%H%M%S")
get_version_number
version = get_version_number(
xcodeproj: "xbks.xcodeproj",
target: "xbks"
)
get_build_number(xcodeproj: "xbb.xcodeproj")
increment_build_number
sync_code_signing
build_app
capture_screenshots
disable_automatic_code_signing(path: "my_project.xcodeproj")
enable_automatic_code_signing(path: "my_project.xcodeproj")
upload_to_testflight
upload_to_app_store
// invokes cert ,invokes是調用的意思
get_certificates
// invokes sigh
get_provisioning_profile
// 獲取推送證書
get_push_certificate
複製代碼
//Swift:
let app = XCUIApplication()
setupSnapshot(app)
app.launch()
//Objective C:
XCUIApplication *app = [[XCUIApplication alloc] init];
[Snapshot setupSnapshot:app];
[app launch];
複製代碼
lane :screenshots do
capture_screenshots
upload_to_app_store
end
//若是不經過lane來執行,可單獨執行每一條指令
fastlane action capture_screenshots
fastlane action upload_to_app_store
複製代碼
fastlane deliver
複製代碼
fastlane frameit
// 使用這個功能,還需安裝依賴的包
brew install libpng jpeg imagemagick
// 若是安裝上面的包報錯:mogrify: no decode delegate for this image format `PNG',按下面的再安裝 brew uninstall imagemagick; brew install libpng jpeg; brew install imagemagick --build-from-source // 下載最新的frameit fastlane frameit setup // 使用 lane :screenshots do capture_screenshots frame_screenshots(white: true) upload_to_app_store end // 單獨使用 fastlane action frame_screenshots // 執行下面的代碼會獲得一組套黑色手機邊框的圖片 fastlane frameit // 執行下面的代碼會獲得白色邊框的圖片 fastlane frameit silver // 支持的手機框顏色 white\silver\rose_gold\gold // 查詢更多用法 fastlane action frameit 複製代碼
// 更新截圖helper文件
fastlane snapshot update
複製代碼
// 單獨發送一條消息,其中slack_url就是你上面獲取到的WebHook URL
lane :slack_message do
slack(
message: "App successfully uploaded to iTunesConnect.",
success: true,
slack_url: "https://your slack incoming webhook url"
)
end
複製代碼