Francis Reynolds
Francis Reynolds

Reputation: 476

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.

Upvotes: 5

Views: 6812

Answers (1)

Francis Reynolds
Francis Reynolds

Reputation: 476

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

Upvotes: 6

Related Questions