美文网首页
使用Fastlane对iOS项目持续集成(自动打包

使用Fastlane对iOS项目持续集成(自动打包

作者: 噗噗puang | 来源:发表于2018-09-04 16:19 被阅读0次

    Fastlane以lane为单位,去执行一个自动化任务,Fastfile中的代码如下:

    platform :ios do #指定持续集成对象的平台名称

    lane :dev do|options|      #给lane命名

    branch = options[:branch]

    schemeName = "ZhongCheDriver"

    #从蒲公英平台拿到的api_key和user_key,下面我会讲怎么拿到这两个key,存在下面两个变量中

    api_key = "bcf18071c659e8ec98f8371539518ad1"

    user_key = "676650d031bf7c72445b4e7395b1901b"

    #输入蒲公英上传ipa包后输入的版本描述信息

    puts "请输入版本描述:"

    desc = STDIN.gets

    puts "开始打包 #{schemeName}"

    # 开始打包

    gym(

    #指定scheme的名字

    scheme: "#{schemeName}",

    #输出的ipa名称

    output_name:"#{schemeName}",

    # 是否清空以前的编译信息 true:是

    clean:true,

    # 指定打包方式,Release 或者 Debug

    configuration:"Debug",

    # 指定打包所使用的输出方式,目前支持app-store, package, ad-hoc, enterprise, development

    export_method:"development",

    # 指定输出文件夹,这里会保存我们最后生成的ipa文件,也就是存到了我们上面提到的fastlane文件夹中的build文件夹中

    output_directory:"./fastlane",

    )

    puts "开始上传到蒲公英"

    #开始上传ipa到蒲公英,这里用的是蒲公英提供的插件

    #update_description代表更新信息

    pgyer(update_description: "#{desc}", api_key: "#{api_key}", user_key: "#{user_key}", install_type: "2")

    #在上传完ipa后,打开ipa的存放文件夹,起到提示上传完成的作用

    system "open ../fastlane"

    end

    end

    相关文章

      网友评论

          本文标题:使用Fastlane对iOS项目持续集成(自动打包

          本文链接:https://www.haomeiwen.com/subject/dctnwftx.html