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 复制代码