get_version_number

Get the version number of your project

This action will return the current version number set on your project.

get_version_number
Supported platforms ios, mac
Author @Liquidsoul, @joshdholtz

2 Examples

version = get_version_number(xcodeproj: "Project.xcodeproj")
version = get_version_number(
  xcodeproj: "Project.xcodeproj",
  target: "App"
)

Parameters

Key Description Default
xcodeproj Path to the main Xcode project to read version number from, optional. By default will use the first Xcode project found within the project root directory
target Target name, optional. Will be needed if you have more than one non-test target to avoid being prompted to select one
configuration Configuration name, optional. Will be needed if you have altered the configurations from the default or your version number depends on the configuration selected

* = default value is dependent on the user's system


Lane Variables

Actions can communicate with each other using a shared hash lane_context, that can be accessed in other actions, plugins or your lanes: lane_context[SharedValues:XYZ]. The get_version_number action generates the following Lane Variables:

SharedValue Description
SharedValues::VERSION_NUMBER The version number

To get more information check the Lanes documentation.


Documentation

To show the documentation in your terminal, run

fastlane action get_version_number

CLI

It is recommended to add the above action into your Fastfile, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal

fastlane run get_version_number

To pass parameters, make use of the : symbol, for example

fastlane run get_version_number parameter1:"value1" parameter2:"value2"

It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"). Hashes are not currently supported.

It is recommended to add all fastlane actions you use to your Fastfile.


Source code

This action, just like the rest of fastlane, is fully open source, view the source code on GitHub


Back to actions