From bf74dd1a4a361f261b1ec755887ec5ec14e8ecc7 Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Sun, 29 Oct 2023 21:46:35 +0700 Subject: [PATCH 1/5] [#454] Add apiKey --- fastlane/Fastfile.swift | 8 ++++++++ fastlane/Helpers/Match.swift | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/fastlane/Fastfile.swift b/fastlane/Fastfile.swift index a5377234..39128524 100644 --- a/fastlane/Fastfile.swift +++ b/fastlane/Fastfile.swift @@ -172,6 +172,14 @@ class Fastfile: LaneFile { registerDevice( name: deviceName, udid: deviceUDID, + apiKey: .userDefined( + [ + "key_id" : EnvironmentParser.string(key: "KEY_ID"), + "issuer_id": EnvironmentParser.string(key: "ISSUER_ID"), + "key": EnvironmentParser.string(key: "KEY"), + "in_house": false + ] + ), teamId: .userDefined(Constant.appleStagingTeamId) ) diff --git a/fastlane/Helpers/Match.swift b/fastlane/Helpers/Match.swift index 2bcdd392..44c67153 100644 --- a/fastlane/Helpers/Match.swift +++ b/fastlane/Helpers/Match.swift @@ -27,6 +27,14 @@ enum Match { type: type.match, readonly: .userDefined(!isForce), appIdentifier: [environment.bundleId], + apiKey: .userDefined( + [ + "key_id" : EnvironmentParser.string(key: "KEY_ID"), + "issuer_id": EnvironmentParser.string(key: "ISSUER_ID"), + "key": EnvironmentParser.string(key: "KEY"), + "in_house": false + ] + ), username: .userDefined(environment.appleUsername), teamId: .userDefined(environment.appleTeamId), gitUrl: Constant.matchURL, From 181fbe33743b959b00804d889618a8b7f2e0d948 Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Sun, 29 Oct 2023 21:58:56 +0700 Subject: [PATCH 2/5] [#454] Add variables to env --- .env.example | 3 +++ fastlane/Constants/Constant.swift | 6 ++++++ fastlane/Fastfile.swift | 9 +-------- fastlane/Helpers/Match.swift | 9 +-------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.env.example b/.env.example index e69de29b..bb5e91d3 100644 --- a/.env.example +++ b/.env.example @@ -0,0 +1,3 @@ +KEY_ID="" +ISSUER_ID="" +KEY="" diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index eb134fb6..552873e3 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -28,6 +28,12 @@ enum Constant { static let appleProductionTeamId = "<#teamId#>" static let keychainName = "{PROJECT_NAME}_keychain" static let matchURL = "git@github.com:{organization}/{repo}.git" + static let apiKey: [String: Any] = [ + "key_id" : EnvironmentParser.string(key: "KEY_ID"), + "issuer_id": EnvironmentParser.string(key: "ISSUER_ID"), + "key": EnvironmentParser.string(key: "KEY"), + "in_house": false + ] // MARK: - Path diff --git a/fastlane/Fastfile.swift b/fastlane/Fastfile.swift index 39128524..35fe6bbf 100644 --- a/fastlane/Fastfile.swift +++ b/fastlane/Fastfile.swift @@ -172,14 +172,7 @@ class Fastfile: LaneFile { registerDevice( name: deviceName, udid: deviceUDID, - apiKey: .userDefined( - [ - "key_id" : EnvironmentParser.string(key: "KEY_ID"), - "issuer_id": EnvironmentParser.string(key: "ISSUER_ID"), - "key": EnvironmentParser.string(key: "KEY"), - "in_house": false - ] - ), + apiKey: .userDefined(Constant.apiKey), teamId: .userDefined(Constant.appleStagingTeamId) ) diff --git a/fastlane/Helpers/Match.swift b/fastlane/Helpers/Match.swift index 44c67153..fd42d025 100644 --- a/fastlane/Helpers/Match.swift +++ b/fastlane/Helpers/Match.swift @@ -27,14 +27,7 @@ enum Match { type: type.match, readonly: .userDefined(!isForce), appIdentifier: [environment.bundleId], - apiKey: .userDefined( - [ - "key_id" : EnvironmentParser.string(key: "KEY_ID"), - "issuer_id": EnvironmentParser.string(key: "ISSUER_ID"), - "key": EnvironmentParser.string(key: "KEY"), - "in_house": false - ] - ), + apiKey: .userDefined(Constant.apiKey), username: .userDefined(environment.appleUsername), teamId: .userDefined(environment.appleTeamId), gitUrl: Constant.matchURL, From 0c5017b57dbde700e66caaa129a817a5db5c083a Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Mon, 6 Nov 2023 12:40:48 +0700 Subject: [PATCH 3/5] [#454] Rename --- .env.example | 4 ++-- fastlane/Constants/Constant.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index bb5e91d3..0096e2ae 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ -KEY_ID="" +API_KEY_ID="" ISSUER_ID="" -KEY="" +APPSTORE_CONNECT_API_KEY="" diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index 552873e3..16da936a 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -29,9 +29,9 @@ enum Constant { static let keychainName = "{PROJECT_NAME}_keychain" static let matchURL = "git@github.com:{organization}/{repo}.git" static let apiKey: [String: Any] = [ - "key_id" : EnvironmentParser.string(key: "KEY_ID"), + "key_id" : EnvironmentParser.string(key: "API_KEY_ID"), "issuer_id": EnvironmentParser.string(key: "ISSUER_ID"), - "key": EnvironmentParser.string(key: "KEY"), + "key": EnvironmentParser.string(key: "APPSTORE_CONNECT_API_KEY"), "in_house": false ] From dd1965a8f0535d92ac74fe697538cc4dd01dab29 Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Mon, 20 Nov 2023 14:21:04 +0700 Subject: [PATCH 4/5] [#454] Update keys --- fastlane/Constants/Constant.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastlane/Constants/Constant.swift b/fastlane/Constants/Constant.swift index 16da936a..c167b9f2 100644 --- a/fastlane/Constants/Constant.swift +++ b/fastlane/Constants/Constant.swift @@ -29,9 +29,9 @@ enum Constant { static let keychainName = "{PROJECT_NAME}_keychain" static let matchURL = "git@github.com:{organization}/{repo}.git" static let apiKey: [String: Any] = [ - "key_id" : EnvironmentParser.string(key: "API_KEY_ID"), - "issuer_id": EnvironmentParser.string(key: "ISSUER_ID"), - "key": EnvironmentParser.string(key: "APPSTORE_CONNECT_API_KEY"), + "key_id" : Secret.appStoreKeyIdKey, + "issuer_id": Secret.appStoreIssuerIdKey, + "key": Secret.appstoreConnectAPIKey, "in_house": false ] From a3d7e1fdcc8cefd41513e9cb1094bdc8bf1647b0 Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Thu, 30 Nov 2023 11:46:04 +0700 Subject: [PATCH 5/5] [#454] Check isForce for apiKey in syncCodeSigning --- fastlane/Helpers/Match.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Helpers/Match.swift b/fastlane/Helpers/Match.swift index fd42d025..2cf6c2a2 100644 --- a/fastlane/Helpers/Match.swift +++ b/fastlane/Helpers/Match.swift @@ -27,7 +27,7 @@ enum Match { type: type.match, readonly: .userDefined(!isForce), appIdentifier: [environment.bundleId], - apiKey: .userDefined(Constant.apiKey), + apiKey: isForce ? .userDefined(Constant.apiKey) : .nil, username: .userDefined(environment.appleUsername), teamId: .userDefined(environment.appleTeamId), gitUrl: Constant.matchURL,