Skip to content

Latest commit

 

History

History
53 lines (44 loc) · 2.33 KB

Advanced.md

File metadata and controls

53 lines (44 loc) · 2.33 KB

Advanced fastlane

Environment Variables

You can define environment variables in a .env or .env.default file in the same directory as your Fastfile. Environment variables are loading used dotenv

Example using dotenv

Filename: .env

WORKSPACE=YourApp.xcworkspace
HOCKEYAPP_API_TOKEN=your-hockey-api-token

Environment specific dotenv variables

fastlane also has a --env option that allows loading of environment specific dotenv files. .env and .env.default will be loaded before environment specific dotenv files are loaded. The naming convention for environment specific dotenv files is .env.<environment>

Example: fastlane <lane-name> --env development will load .env, .env.default, and .env.development

Lane Context

The different actions can communicate with each other using a shared hash. Access them in your scrips using:

Actions.lane_context[Actions::SharedValues::LANE_NAME] # the name of the current lane

Available variables (put that inside the square brackets of the above snippet)

Actions::SharedValues::BUILD_NUMBER # generated by `increment_build_number`
Actions::SharedValues::SNAPSHOT_SCREENSHOTS_PATH # generated by `snapshot`
Actions::SharedValues::PRODUCE_APPLE_ID # the Apple ID of the newly created app
Actions::SharedValues::IPA_OUTPUT_PATH # generated by `ipa`
Actions::SharedValues::SIGH_PROFILE_PATH # generated by `sigh`
Actions::SharedValues::SIGH_UDID # the UDID of the generated provisioning profile
Actions::SharedValues::HOCKEY_DOWNLOAD_LINK #generated by `hockey`
Actions::SharedValues::DEPLOYGATE_URL # generated by `deploygate`
Actions::SharedValues::DEPLOYGATE_APP_REVISION # integer, generated by `deploygate`
Actions::SharedValues::DEPLOYGATE_APP_INFO # Hash, generated by `deploygate`

Run multiple lanes

You can run multiple lanes (in the given order) using

fastlane test inhouse appstore

Keep in mind the before_all and after_all block will be executed for each of the lanes.

Hide the fastlane folder

Just rename the folder to .fastlane in case you don't want it to be visible in the Finder.

Load own actions from external folder

Add this to the top of your Fastfile (. is the fastlane folder)

actions_path '../custom_actions_folder/'