Fastlane (iOS)
(5 minute setup time)
Install the plugin
The Emerge Fastlane plugin makes it easy to upload iOS builds in your CI pipeline. You can add it to your project by running:
fastlane add_plugin emerge
Obtain an API key
On your Emerge profile page click the button to Create a new API Key. Make sure you save the resulting key, as you won't be able to view it again on the Emerge site.
Call the upload API
In your Fastfile, provide the API key as an environment variable (ideally without including it in source control, for security) and run the Emerge action like so:
ENV['EMERGE_API_TOKEN'] = 'COPIED_FROM_EMERGETOOLS_PROFILE'
platform {:ios} do
lane :app_size do
emerge(file_path: "path to .xcarchive")
end
end
This will upload the provided archive to Emerge for processing and print a URL to view the results.
Fastlane Context
The archive path can be shared from your other lane steps using lane_context. If you're already building the app in Fastlane with
build_app
you can omit thefile_path
parameter and it will be automatically inferred from context.
Setup PR diffs
A few extra arguments are required for PR comments to work:
- sha: The SHA of the commit that your app was built from.
- base_sha: The SHA of the base commit your app was built from. For example, the last commit from
main
before you created the current branch. - branch: The name of your current git branch.
- repo_name: Name of your GitHub repository.
- pr_number: Number of the pull request that triggered this build.
Optionally, include the following for additional information:
- build_type: A string indicating what type of build this is.
"development"
by default if not specified. For example, this could be something like"alpha"
,"beta"
or anything of your choosing depending on the type of build you're uploading.
These parameters work with the Emerge GitHub app to find the base build that was already uploaded and post the comment to your PR.
emerge(
file_path: "path to .xcarchive",
repo_name: "EmergeTools/MyAwesomeApp",
pr_number: "2",
sha: "git SHA",
base_sha: "git SHA",
build_type: "Optional, 'development' by default"
)
Congrats on integrating Fastlane with Emerge!
Please feel free to contact support with any issues or feedback!
Updated 6 months ago