Let's put our theory into practice and improve our Fastfile by including purposeful Git actions, starting with a lane that you may have noticed previously, but that we haven't covered yet, namely the prebuilt before_all *
lane. This lane gets called before any fastlane lane is called, and is a great place to put any actions and commands that would commonly apply across all of the lanes—for instance, when running any preparation or cleanup scripts prior to calling a build or test.
We are going to start off by calling the carthage
(https://docs.fastlane.tools/actions/carthage/#carthage) action to ensure we have the most up-to-date dependencies. Using the bootstrap
command argument, we can optimize this call so that it only downloads the necessary dependencies as required:
platform :ios do before_all do carthage( command: options[:update] ? "update" : "bootstrap", platform: "iOS", use_binaries...