Skip to content

Commit

Permalink
Merge pull request #459 from nimblehq/310-multiple-apple-accounts
Browse files Browse the repository at this point in the history
[#310] Support multiple apple portal accounts
  • Loading branch information
vnntsu authored Apr 28, 2023
2 parents ebcb4cc + 68aef48 commit 2b433c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
22 changes: 19 additions & 3 deletions fastlane/Constants/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ enum Constant {

// MARK: - Match

static let userName = "<#userName#>"
static let teamId = "<#teamId#>"
static let appleStagingUserName = "<#userName#>"
static let appleStagingTeamId = "<#teamId#>"
static let appleProductionUserName = "<#userName#>"
static let appleProductionTeamId = "<#teamId#>"
static let keychainName = "github_action_keychain"
static let matchURL = "[email protected]:{organization}/{repo}.git"

Expand Down Expand Up @@ -86,7 +88,7 @@ extension Constant {
var scheme: String {
switch self {
case .staging: return "\(Constant.projectName) \(rawValue)".trimmed
case .production: return Constant.projectName
case .production: return Constant.projectName.trimmed
}
}

Expand Down Expand Up @@ -117,6 +119,20 @@ extension Constant {
let outputDirectoryURL = URL(fileURLWithPath: Constant.outputPath)
return outputDirectoryURL.appendingPathComponent(productName + ".app" + Constant.dSYMSuffix).relativePath
}

var appleUsername: String {
switch self {
case .staging: return Constant.appleStagingUserName
case .production: return Constant.appleProductionUserName
}
}

var appleTeamId: String {
switch self {
case .staging: return Constant.appleStagingTeamId
case .production: return Constant.appleProductionTeamId
}
}
}

enum BuildType: String {
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Fastfile: LaneFile {
registerDevice(
name: deviceName,
udid: deviceUDID,
teamId: .userDefined(Constant.teamId)
teamId: .userDefined(Constant.appleStagingTeamId)
)

Match.syncCodeSigning(type: .development, environment: .staging, isForce: true)
Expand Down
10 changes: 5 additions & 5 deletions fastlane/Helpers/Match.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ enum Match {
type: type.match,
readonly: .userDefined(!isForce),
appIdentifier: [environment.bundleId],
username: .userDefined(Constant.userName),
teamId: .userDefined(Constant.teamId),
username: .userDefined(environment.appleUsername),
teamId: .userDefined(environment.appleTeamId),
gitUrl: Constant.matchURL,
keychainName: Constant.keychainName,
keychainPassword: .userDefined(Secret.keychainPassword),
Expand All @@ -27,8 +27,8 @@ enum Match {
type: type.match,
readonly: .userDefined(!isForce),
appIdentifier: [environment.bundleId],
username: .userDefined(Constant.userName),
teamId: .userDefined(Constant.teamId),
username: .userDefined(environment.appleUsername),
teamId: .userDefined(environment.appleTeamId),
gitUrl: Constant.matchURL,
force: .userDefined(isForce)
)
Expand All @@ -41,7 +41,7 @@ enum Match {
updateCodeSigningSettings(
path: Constant.projectPath,
useAutomaticSigning: .userDefined(false),
teamId: .userDefined(Constant.teamId),
teamId: .userDefined(environment.appleTeamId),
targets: .userDefined([Constant.projectName]),
buildConfigurations: .userDefined([Self.createBuildConfiguration(type: type, environment: environment)]),
codeSignIdentity: .userDefined(type.codeSignIdentity),
Expand Down

0 comments on commit 2b433c4

Please sign in to comment.