This is one of the biggest updates of fastlane
yet: You can now execute lanes from within lanes and even pass parameters.
This allows you to move common build steps into a shared lane. Additionally it's now also possible to pass parameters from the command line to your lane.
Passing Parameters
To pass parameters from the command line to your lane, use the following syntax:
fastlane [lane] key:value key2:value2
fastlane deploy submit:false build_number:24
To access those values, change your lane decleration to also include |options|
lane :deploy do |options|
...
if options[:submit]
# Only when submit is true
end
...
increment_build_number(build_number: options[:build_nymber])
...
end
Switching lanes
To switch lanes while executing a lane, use the following code:
lane :deploy do |options|
...
build(release: true) # that's the important bit
hockey
...
end
lane :staging do |options|
...
build # it also works when you don't pass parameters
hockey
...
end
lane :build do |options|
scheme = (options[:release] ? "Release" : "Staging")
ipa(scheme: scheme)
end
fastlane
takes care of all the magic for you. You can call lanes of the same platform or a general lane outside of the platform
definition.
Passing parameters is optional.
Returning values
Additionally, you can retrieve the return value. In Ruby, the last line of the lane
definition is the return value. Here is an example:
lane :deploy do |options|
value = calculate(value: 3)
puts value # => 5
end
lane :calculate do |options|
...
2 + options[:value] # the last line will always be the return value
end
More changes
- Upload of the
dsym
file by default when using the hockey integration - Improved importing of certificates (thanks @milch)
- Updated documentation