0

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)?

Terminus
  • 925
  • 10
  • 23

1 Answers1

0

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: "ooxx@match.storage")       

  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: "ooxx@match.storage")       

  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.

AechoLiu
  • 17,522
  • 9
  • 100
  • 118
  • I would like to avoid any dependence on Xcode files when making this decision. So I have the same app ID, the same schemes, etc. but I have two different certs and two different prov profiles (with names) and would like to choose among them based on some external criteria. – Terminus Sep 16 '21 at 20:31