Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - How to increase the version number with Fastlane?

So I was wondering how to increase the version number or build number with Fastlane tools, so that I don't have to manually change the version.

like image 551
Francis Reynolds Avatar asked Nov 22 '17 14:11

Francis Reynolds


1 Answers

So the answer to this question where the following two lanes. Keep in mind you need to activate some settings in your project by following this link.

With them I can increase the build number for the current version, or increase the version number and set the build number to 1.

The result will be [ver++] v1.0.0 (1) (you can change the syntax as you please) and it gets automatically committed to git

Build Bump:

lane :buildbump do

  version = get_version_number
  build = increment_build_number
  commit_version_bump(
    xcodeproj:"MyProject.xcodeproj",
    message: "[ver++] v#{version} (#{build})"
  )

end

Version Bump:

lane :versionbump do

  version = increment_version_number
  build = increment_build_number(build_number: 1)
  commit_version_bump(
    xcodeproj:"MyProject.xcodeproj",
    message: "[ver++] v#{version} (#{build})"
  )

  end
like image 69
Francis Reynolds Avatar answered Nov 11 '22 01:11

Francis Reynolds