使用 plist 变量和 Fastlane 来增加构建号

问题描述 投票:0回答:2

我希望 fastlane 使用我放在 plist 的

CURRENT_PROJECT_VERSION
下的名为
Bundle version
的变量。现在,它增加捆绑包版本并对我所有目标上的值进行硬编码,而不是仅仅增加单个变量。

问题是,如果我想有一天手动增加它,我必须在我的所有目标上手动更改它,因为 fastlane 在每个构建上都会断开与我的变量的链接。

这是我当前的fastlane设置:

  lane :bumpVersion do
    increment_build_number
    commit_version_bump
  end
ios swift fastlane
2个回答
1
投票

你可以尝试这样的事情

def infoPlistPath
    rootDir = File.expand_path("..", Dir.pwd)
    infoPlistPath = "#{rootDir}/Project/Target/Info.plist"
    return infoPlistPath
end

def currentProjectVersion
    version = get_info_plist_value(path: infoPlistPath, key: "CURRENT_PROJECT_VERSION")
    return version
end

lane :bumpVersion do
    increment_build_number(
      build_number: currentProjectVersion,
    )
end

0
投票

有一个

skip_info_plist
选项,您可以传递给
increment_build_number
以防止它接触
.plist
文件。所以:

increment_build_number(skip_info_plist: true)

文档

© www.soinside.com 2019 - 2024. All rights reserved.