安装 fastlane
这里使用Rubygems 方式安装fastlane。(MacOS or Linux with ruby 2.0.0 or above)
sudo gem install fastlane
设置fastlane
用Terminal进入你的项目目录,然后执行
fastlane init
然后会询问你的Apple ID,根据提供的信息,生成fastlane的配置文件

使用fastlane测试部署
构建你的应用
编辑fastfile:
lane :beta do
    gym(scheme: "MyApp",
        workspace: "MyApp.xcworkspace",
        include_bitcode: true)
end
测试运行我们定制的 lane(任务):
fastlane beta
如果顺利执行的话,你将会在当前文件目录看到一个 MyApp.ipa 文件和对应 MyApp.app.dSYM 文件
上传应用
lane :beta do
    match(type: "appstore")                 # see code signing guide for more information
    gym(scheme: "MyApp",
        workspace: "MyApp.xcworkspace",
        include_bitcode: true)              # build your app
    testflight                              # upload your app to TestFlight
    
end
或者再配置下上传至TestFlight的过程:
lane :beta do
    match(type: "appstore")             
    gym(scheme: "MyApp",
        workspace: "MyApp.xcworkspace",
        include_bitcode: true) 
                     
    # Variant 1: Provide a changelog to your build
    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
    testflight(skip_waiting_for_build_processing: true)
    
end
使用fastlane部署至Apple Store
编辑Fastfile:
lane :appstore do
    
    snapshot
    #gym(scheme: "MyApp")
    gym(scheme: "MyApp",
        workspace: "MyApp.xcworkspace",
        include_bitcode: true)
    appstore
end
执行:
fastlane appstore