使用fastlane打包iOS測試版本
打包你的app
fastlane使用名叫build_app的action來打包你的app,添加如下代碼到你的Fastfile:
lane :beta do
build_app(scheme: "MyApp")
end
你可以添加更多的參數(shù)來構(gòu)建你的app,舉例
lane :beta do
build_app(scheme: "MyApp",
workspace: "Example.xcworkspace",
include_bitcode: true)
end
你可以使用下面代碼來執(zhí)行
fastlane beta
如果成功了,你可以在當(dāng)前目錄下找到一個(gè)[產(chǎn)品名稱].ipa.獲取更多相關(guān)參數(shù)可以執(zhí)行fastlane action build_app.
簽名
如果你在上一步因?yàn)楹灻鴮?dǎo)致失敗,我們準(zhǔn)備了簽名向?qū)?/a>幫助你設(shè)置你應(yīng)用的簽名.
上傳你的app
在你構(gòu)建完成你的app后.它將根據(jù)你的選擇上傳你的測試版本.fastlane的長處在于可以輕松的更換測試提供者,或者一次上傳至多處而不要更多的工作.
你所要做的只是把測試提供者的名字列舉在你的build_applane中:
lane :beta do
sync_code_signing(type: "appstore") # see code signing guide for more information
build_app(scheme: "MyApp")
upload_to_testflight
slack(message: "Successfully distributed a new beta build")
end
fastlane會自動的將.ipa的相關(guān)信息從build_app中發(fā)送至你選擇的測試提供者.
獲取所有可用參數(shù)你可以:
fastlane action slack
Beta測試提供者
- TestFlight
你可以使用fastlane輕松的上傳測試包到testflight上.只需要添加testflightaction在打包完成后
lane :beta do
# ...
build_app
upload_to_testflight
end
一些例子
lane :beta do
# ...
build_app
# Variant 1: Provide a changelog to your build
upload_to_testflight(changelog: "Add rocket emoji")
# Variant 2: Skip the "Waiting for processing" of the binary
# While this will speed up your build, it will not distribute
# the binary to your tests, nor set a changelog
upload_to_testflight(skip_waiting_for_build_processing: true)
end
如果你使用fastlane init 設(shè)置fastlane,你的appID存儲在fastlane/Appfile中.你也可以重寫用戶名使用upload_to_testflight(username: "bot@fastlane.tools").
獲取可用參數(shù)你可以
fastlane action upload_to_testflight
你也可以使用fastlane自動管理你的測試者.
- Crashlytics
lane :beta do
# ...
build_app
crashlytics(api_token: "[insert_key_here]",
build_secret: "[insert_key_here]")
end
你可以通過組織設(shè)置頁面獲取你的API key 和secret links.
獲取更多可用參數(shù)
fastlane action crashlytics
- HockeyApp
lane :beta do
# ...
build_app
hockey(api_token: "[insert_key_here]")
end
可以在API Tokens賬戶設(shè)置獲取你的API token.
發(fā)布標(biāo)注
- 根據(jù)git commits自動生成
你可以更改日志,這樣就不需要太多的語句存儲在Fastfile中.
lane :beta do
sync_code_signing
build_app
changelog_from_git_commits # this will generate the changelog based on your last commits
upload_to_testflight
end
更多的例子:
changelog_from_git_commits(
between: ['7b092b3', 'HEAD'], # Optional, lets you specify a revision/tag range between which to collect commit info
merge_commit_filtering: exclude_merges # Optional, lets you filter out merge commits
)
- 根據(jù)日志生成
你也可以根據(jù)日志自動生成標(biāo)注
lane :beta do
# Variant 1: Ask for a one line input
changelog = prompt(text: "Changelog: ")
# Variant 2: Ask for a multi-line input
# The user confirms their input by typing `END` and Enter
changelog = prompt(
text: "Changelog: ",
multi_line_end_keyword: "END"
)
sync_code_signing
build_app
upload_to_testflight(changelog: changelog)
end
[http://www.itdecent.cn/p/2a029dda5337](fastlane iOS官方翻譯五 (生成正式包))