Create an Emerge API key and copy it into your Travis CI environment variables.
In your .travis.yml file configure your build to trigger a fastlane action
language: swift osx_image: xcode13.1 script: - bundle exec fastlane app_size
The Fastlane action will upload either a release build or development build to Emerge depending on the branch used to trigger the build.
When a build is triggered by a pull request, Travis merges the master branch into your PR branch. We can access the SHA of the merge commit's parent to obtain a
base_build_id that gets passed to the Emerge action.
When a build is triggered from the master branch we upload a
master build type with the current git SHA as the
Here’s an example
Fastfile that brings it all together:
fastlane_require 'git' default_platform(:ios) g = Git.open('..') platform :ios do lane :app_size do build_app( project: "MyProject.xcodeproj", configuration: "Release", scheme: "MyScheme", archive_path: "MyArchive.xcarchive") zip( path: "MyArchive.xcarchive", output_path: "MyArchive.xcarchive.zip" ) branch = ENV["TRAVIS_BRANCH"] if ENV["TRAVIS_PULL_REQUEST"] != "false" baseBuildId = g.log.parent.sha emerge( file_path: "MyArchive.xcarchive.zip", build_type: "pull_request", repo_name: "mycompany/myrepo", pr_number: ENV["TRAVIS_PULL_REQUEST"], sha: g.log.parents.sha, base_sha: g.log.parent.sha) elsif branch.eql? "master" emerge( file_path: "MyArchive.xcarchive.zip", build_type: "master", repo_name: "mycompany/myrepo", sha: g.log.sha) end end end
Updated about 1 year ago