【问题标题】:Fastlane - Override output nameFastlane - 覆盖输出名称
【发布时间】:2017-08-10 01:25:52
【问题描述】:

我使用fastlane ios lanename 构建,但是为了集成到 Jenkins 中,我想覆盖输出文件名。默认情况下,输出名称在 Fastfile 健身房选项中定义,但我想将版本和内部版本号添加到 Jenkins 中的文件名中。

但是这个命令并没有削减它:

fastlane ios build_dev_stg output_name:"App_Dev_Staging_2.5.1.3452"

尝试此操作后,输出文件名仍然与 Fastfile 中定义的相同。有没有其他方法可以覆盖它?

【问题讨论】:

    标签: ios jenkins fastlane fastlane-gym


    【解决方案1】:

    你做的有点不对,但意图是对的。

    您不必将参数传递给您的车道 (build_dev_stg)。

    您需要在您的健身房上通过该选项,在您的车道内。

    我的前任:

    lane :buildDev do |options|
      [.... Set nameSuffix, versionName and so on ...]
      ipaName = "MyApp_#{nameSuffix}_#{versionName}_#{buildNumber}.ipa"
      gym(
        configuration: configuration,
        scheme: scheme,
        export_method: export_method,
        output_name: ipaName
      )
    end
    

    希望对你有帮助,有什么问题欢迎提问

    【讨论】:

      【解决方案2】:

      特此共享一个示例通道,该通道根据当前版本和内部版本号生成一个内部版本名称。在我的设置中使用了相同的设置。

      # Can be called from other lanes as:
      # Build Name
      output_build_name = ""
      generate_build_name
      
      #Generate the build
      build(build_name: output_build_name)
      
      # Lane to create build name using the version
      lane :generate_build_name do |options|
      
      # https://github.com/beplus/fastlane-plugin-versioning_ios
      # Get version and build number install above plugin
      version = get_version_number(target: target)
      build_number = get_build_number(xcodeproj: project)
      puts "VERSION : #{version}"
      
      current_date = Time.new.strftime('%Y.%m.%d')
      build_name = "-Ver-"+ version + "-B-" + build_number + "-" +current_date
      output_build_name = app_name + "-" + build_name
      
      # Build name
      puts "#{app_name} BUILD NAME : #{output_build_name}" 
      // BUILD NAME : AppName-Ver-1.0-B-31-2019.09.16
      end
      
      lane :build do |options|
      build_app(
        workspace: "MyApp.xcworkspace",
        configuration: "Debug",
        scheme: "MyApp",
        silent: true,
        clean: true,
        output_name: options[:build_name] + ".ipa"
      )
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-29
        • 2016-02-13
        • 1970-01-01
        • 2018-05-31
        • 1970-01-01
        • 2016-11-19
        相关资源
        最近更新 更多