Fastlane with multiple certificates

1.1k Views Asked by At

Let us say that we have two valid certificates and two corresponding provisioning profiles for a single application.

Let us say that we need this setup for reasons unrelated to the question.

How can we use fastlane / fastlane match to use either one or another depending on some additional conditions (to be specified in fastfile)?

1

There are 1 best solutions below

1
On

The certificate / provisioning profiles can be mapped by app id, and build schemes, which named with release, or custom names like appStore, appStore_forA, appStore_forB.

I has an app, with 2 different app id. ex, app_A, and app_B. I distinguish them by build scheme. One is appStore_A, and another is appStore_B.

In my fastlane file, it likes following.

// For build app_A, and upload to TestFlight.
lane: app_A do
  api_key = app_store_connect_api_key( /* for `pilot` auth */)

  match(type: "appstore", readonly: true, git_url: "[email protected]")       

  gym(
     clean: true,
     scheme: "appStore_A",
     configuration: "AppStore",
     workspace: "app.xcworkspace",
  )

  pilot(
     app_identifier: "com.app_A",
     api_key: api_key
  )
end

// For build app_B, and upload to TestFlight.
lane: app_B do
  api_key = app_store_connect_api_key( /* for `pilot` auth */)

  match(type: "appstore", readonly: true, git_url: "[email protected]")       

  gym(
     clean: true,
     scheme: "appStore_B",
     configuration: "AppStore",
     workspace: "app.xcworkspace",
  )

  pilot(
     app_identifier: "com.app_B",
     api_key: api_key
  )
end

app_A, and app_B use the same app.xcworkspace, but they are in different scheme and different app target.