brew install fastlane
安裝fastlane
進入iOS項目根目錄
fastlane init
fastfile文件
# fastlane/Fastfile
default_platform(:ios)
platform :ios do
desc "打包并上傳到 App Store"
lane :release do
# 1. 更新版本號
increment_version_number(
version_number: "1.0.0" # 設(shè)置版本號
)
# 2. 更新構(gòu)建號
increment_build_number(
build_number: "1" # 設(shè)置構(gòu)建號
)
# 3. 獲取證書和描述文件
# match(
# type: "appstore",
# readonly: true
# )
# 4. 構(gòu)建應(yīng)用
build_app(
scheme: "Runner", # 替換為您的 scheme 名稱
export_method: "app-store",
export_options: {
method: "app-store",
provisioningProfiles: {
"com.bydauto.f-dealer" => "FDealer_AppStore" # 替換為您的 Bundle ID 和描述文件名稱
},
signingStyle: "manual", # 使用本地證書
signingCertificate: "fd_dis.p12" # 證書名稱
}
)
# 5. 上傳到 App Store Connect
upload_to_app_store(
skip_screenshots: true,
skip_metadata: true
)
end
desc "打包測試版本"
lane :beta do
# 1. 更新構(gòu)建號
increment_build_number(
build_number: "1"
)
# 2. 獲取證書和描述文件
# match(
# type: "adhoc",
# readonly: true
# )
# 3. 構(gòu)建應(yīng)用
build_app(
scheme: "Runner",
export_method: "development",
export_options: {
method: "development",
provisioningProfiles: {
"com.bydauto.f-dealer" => "FDealer_Develop"
},
signingStyle: "manual", # 使用本地證書
signingCertificate: "fd.p12" # 證書名稱
}
)
# 4. 上傳到 TestFlight
upload_to_testflight
end
end
appfile文件
app_identifier "com.bydauto.f-dealer" # The bundle identifier of your app
apple_id "ipdappstore@byd.com" # Your Apple Developer Portal username
team_id "9YWJ3PZHZG" # 開發(fā)者團隊 ID