简体   繁体   中英

Increment build number using plist variable with Fastlane

I want fastlane to use the variable named CURRENT_PROJECT_VERSION that I put under Bundle version of my plist. Right now, it increment the bundle version and hardcode the value on all my target instead of just incrementing that single variable.

Problem is, if I want someday to increment it manually, I have to change it by hand on all my target since fastlane break the link with my variable on every build.

Here is my current fastlane setup:

  lane :bumpVersion do
    increment_build_number
    commit_version_bump
  end

You can try something like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM