From 72545b1ee252f1c8e5122e3e6f0ae77cbef95bc2 Mon Sep 17 00:00:00 2001 From: nkhanh44 Date: Sun, 29 Oct 2023 21:58:56 +0700 Subject: [PATCH] [#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,