fastlane 2.183.0 → 2.185.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -91
  3. data/cert/lib/cert/runner.rb +3 -7
  4. data/deliver/lib/deliver/commands_generator.rb +1 -1
  5. data/deliver/lib/deliver/detect_values.rb +5 -3
  6. data/deliver/lib/deliver/download_screenshots.rb +1 -1
  7. data/deliver/lib/deliver/html_generator.rb +2 -2
  8. data/deliver/lib/deliver/module.rb +6 -0
  9. data/deliver/lib/deliver/options.rb +36 -51
  10. data/deliver/lib/deliver/runner.rb +8 -11
  11. data/deliver/lib/deliver/setup.rb +1 -1
  12. data/deliver/lib/deliver/submit_for_review.rb +1 -1
  13. data/deliver/lib/deliver/upload_metadata.rb +20 -6
  14. data/deliver/lib/deliver/upload_price_tier.rb +1 -1
  15. data/deliver/lib/deliver/upload_screenshots.rb +1 -1
  16. data/fastlane/lib/fastlane/actions/adb.rb +1 -4
  17. data/fastlane/lib/fastlane/actions/adb_devices.rb +0 -1
  18. data/fastlane/lib/fastlane/actions/add_git_tag.rb +4 -4
  19. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +10 -15
  20. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +12 -2
  21. data/fastlane/lib/fastlane/actions/appetize_viewing_url_generator.rb +0 -11
  22. data/fastlane/lib/fastlane/actions/carthage.rb +1 -1
  23. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +5 -1
  24. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +35 -16
  25. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +10 -4
  26. data/fastlane/lib/fastlane/actions/get_certificates.rb +5 -1
  27. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +5 -1
  28. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +5 -1
  29. data/fastlane/lib/fastlane/actions/register_device.rb +7 -10
  30. data/fastlane/lib/fastlane/actions/register_devices.rb +7 -10
  31. data/fastlane/lib/fastlane/actions/set_changelog.rb +7 -10
  32. data/fastlane/lib/fastlane/actions/swiftlint.rb +17 -15
  33. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +6 -1
  34. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +5 -1
  35. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +2 -1
  36. data/fastlane/lib/fastlane/environment_printer.rb +1 -0
  37. data/fastlane/lib/fastlane/helper/git_helper.rb +12 -7
  38. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +1 -1
  39. data/fastlane/lib/fastlane/swift_fastlane_function.rb +8 -5
  40. data/fastlane/lib/fastlane/version.rb +1 -1
  41. data/fastlane/swift/Deliverfile.swift +1 -1
  42. data/fastlane/swift/DeliverfileProtocol.swift +20 -20
  43. data/fastlane/swift/Fastlane.swift +3032 -2604
  44. data/fastlane/swift/Gymfile.swift +1 -1
  45. data/fastlane/swift/GymfileProtocol.swift +1 -1
  46. data/fastlane/swift/Matchfile.swift +1 -1
  47. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  48. data/fastlane/swift/OptionalConfigValue.swift +2 -32
  49. data/fastlane/swift/Precheckfile.swift +1 -1
  50. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  51. data/fastlane/swift/Scanfile.swift +1 -1
  52. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  53. data/fastlane/swift/Screengrabfile.swift +1 -1
  54. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  55. data/fastlane/swift/Snapshotfile.swift +1 -1
  56. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  57. data/fastlane/swift/formatting/Brewfile.lock.json +11 -11
  58. data/fastlane_core/lib/fastlane_core/build_watcher.rb +26 -3
  59. data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +5 -0
  60. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +5 -3
  61. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +1 -1
  62. data/fastlane_core/lib/fastlane_core/helper.rb +12 -0
  63. data/match/lib/match/importer.rb +6 -10
  64. data/match/lib/match/migrate.rb +2 -3
  65. data/match/lib/match/nuke.rb +3 -7
  66. data/match/lib/match/options.rb +1 -0
  67. data/match/lib/match/runner.rb +2 -3
  68. data/match/lib/match/spaceship_ensure.rb +3 -0
  69. data/match/lib/match/storage/google_cloud_storage.rb +2 -2
  70. data/match/lib/match/storage/s3_storage.rb +2 -2
  71. data/pilot/lib/pilot/build_manager.rb +7 -1
  72. data/pilot/lib/pilot/manager.rb +3 -7
  73. data/pilot/lib/pilot/options.rb +10 -2
  74. data/precheck/lib/precheck/runner.rb +8 -7
  75. data/sigh/lib/assets/resign.sh +81 -61
  76. data/sigh/lib/sigh/download_all.rb +4 -8
  77. data/sigh/lib/sigh/runner.rb +4 -8
  78. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +36 -4
  79. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +10 -0
  80. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +2 -3
  81. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +3 -1
  82. data/spaceship/lib/spaceship/connect_api/models/build.rb +2 -0
  83. data/spaceship/lib/spaceship/connect_api/token.rb +6 -0
  84. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +4 -2
  85. data/supply/lib/supply/client.rb +2 -2
  86. data/supply/lib/supply/uploader.rb +2 -2
  87. metadata +20 -20
  88. data/spaceship/lib/spaceship/connect_api/models/.app.rb.swp +0 -0
@@ -17,4 +17,4 @@ public class Gymfile: GymfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.183.0
20
+ // Generated with fastlane 2.185.0
@@ -196,4 +196,4 @@ public extension GymfileProtocol {
196
196
 
197
197
  // Please don't remove the lines below
198
198
  // They are used to detect outdated files
199
- // FastlaneRunnerAPIVersion [0.9.70]
199
+ // FastlaneRunnerAPIVersion [0.9.75]
@@ -17,4 +17,4 @@ public class Matchfile: MatchfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.183.0
20
+ // Generated with fastlane 2.185.0
@@ -184,4 +184,4 @@ public extension MatchfileProtocol {
184
184
 
185
185
  // Please don't remove the lines below
186
186
  // They are used to detect outdated files
187
- // FastlaneRunnerAPIVersion [0.9.64]
187
+ // FastlaneRunnerAPIVersion [0.9.69]
@@ -23,38 +23,6 @@ public enum OptionalConfigValue<T> {
23
23
  }
24
24
  }
25
25
 
26
- extension Optional: ExpressibleByIntegerLiteral where Wrapped: ExpressibleByIntegerLiteral {
27
- public typealias IntegerLiteralType = Wrapped.IntegerLiteralType
28
-
29
- public init(integerLiteral value: Wrapped.IntegerLiteralType) {
30
- self = .some(.init(integerLiteral: value))
31
- }
32
- }
33
-
34
- extension Optional: ExpressibleByUnicodeScalarLiteral where Wrapped: ExpressibleByUnicodeScalarLiteral {
35
- public typealias UnicodeScalarLiteralType = Wrapped.UnicodeScalarLiteralType
36
-
37
- public init(unicodeScalarLiteral value: Wrapped.UnicodeScalarLiteralType) {
38
- self = .some(.init(unicodeScalarLiteral: value))
39
- }
40
- }
41
-
42
- extension Optional: ExpressibleByExtendedGraphemeClusterLiteral where Wrapped: ExpressibleByStringLiteral {
43
- public typealias ExtendedGraphemeClusterLiteralType = Wrapped.ExtendedGraphemeClusterLiteralType
44
-
45
- public init(extendedGraphemeClusterLiteral value: Wrapped.ExtendedGraphemeClusterLiteralType) {
46
- self = .some(.init(extendedGraphemeClusterLiteral: value))
47
- }
48
- }
49
-
50
- extension Optional: ExpressibleByStringLiteral where Wrapped: ExpressibleByStringLiteral {
51
- public typealias StringLiteralType = Wrapped.StringLiteralType
52
-
53
- public init(stringLiteral value: Wrapped.StringLiteralType) {
54
- self = .some(.init(stringLiteral: value))
55
- }
56
- }
57
-
58
26
  extension OptionalConfigValue: ExpressibleByUnicodeScalarLiteral where T == String? {
59
27
  public typealias UnicodeScalarLiteralType = String
60
28
 
@@ -79,6 +47,8 @@ extension OptionalConfigValue: ExpressibleByStringLiteral where T == String? {
79
47
  }
80
48
  }
81
49
 
50
+ extension OptionalConfigValue: ExpressibleByStringInterpolation where T == String? {}
51
+
82
52
  extension OptionalConfigValue: ExpressibleByNilLiteral {
83
53
  public init(nilLiteral _: ()) {
84
54
  self = .nil
@@ -17,4 +17,4 @@ public class Precheckfile: PrecheckfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.183.0
20
+ // Generated with fastlane 2.185.0
@@ -52,4 +52,4 @@ public extension PrecheckfileProtocol {
52
52
 
53
53
  // Please don't remove the lines below
54
54
  // They are used to detect outdated files
55
- // FastlaneRunnerAPIVersion [0.9.63]
55
+ // FastlaneRunnerAPIVersion [0.9.68]
@@ -17,4 +17,4 @@ public class Scanfile: ScanfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.183.0
20
+ // Generated with fastlane 2.185.0
@@ -292,4 +292,4 @@ public extension ScanfileProtocol {
292
292
 
293
293
  // Please don't remove the lines below
294
294
  // They are used to detect outdated files
295
- // FastlaneRunnerAPIVersion [0.9.75]
295
+ // FastlaneRunnerAPIVersion [0.9.80]
@@ -17,4 +17,4 @@ public class Screengrabfile: ScreengrabfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.183.0
20
+ // Generated with fastlane 2.185.0
@@ -96,4 +96,4 @@ public extension ScreengrabfileProtocol {
96
96
 
97
97
  // Please don't remove the lines below
98
98
  // They are used to detect outdated files
99
- // FastlaneRunnerAPIVersion [0.9.65]
99
+ // FastlaneRunnerAPIVersion [0.9.70]
@@ -17,4 +17,4 @@ public class Snapshotfile: SnapshotfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.183.0
20
+ // Generated with fastlane 2.185.0
@@ -200,4 +200,4 @@ public extension SnapshotfileProtocol {
200
200
 
201
201
  // Please don't remove the lines below
202
202
  // They are used to detect outdated files
203
- // FastlaneRunnerAPIVersion [0.9.59]
203
+ // FastlaneRunnerAPIVersion [0.9.64]
@@ -2,30 +2,30 @@
2
2
  "entries": {
3
3
  "brew": {
4
4
  "swiftformat": {
5
- "version": "0.48.1",
5
+ "version": "0.48.4",
6
6
  "bottle": {
7
7
  "rebuild": 0,
8
8
  "root_url": "https://ghcr.io/v2/homebrew/core",
9
9
  "files": {
10
10
  "arm64_big_sur": {
11
11
  "cellar": ":any_skip_relocation",
12
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:937b21c64f3aec2eaf9d0234f681013e1026f3110bafac9348a58e893305c266",
13
- "sha256": "937b21c64f3aec2eaf9d0234f681013e1026f3110bafac9348a58e893305c266"
12
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:d85e28a31b1b0c3120d796f9dec0eb001369adb5166371f2dcb16bd9972ddc05",
13
+ "sha256": "d85e28a31b1b0c3120d796f9dec0eb001369adb5166371f2dcb16bd9972ddc05"
14
14
  },
15
15
  "big_sur": {
16
16
  "cellar": ":any_skip_relocation",
17
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:e5217aee36051fd378912b4620786b5892ec4b69343e06f6b94747ab08e1c0ea",
18
- "sha256": "e5217aee36051fd378912b4620786b5892ec4b69343e06f6b94747ab08e1c0ea"
17
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:b8572efabc3aa0627898ae23fbb7847e5e007fb631217df54d30ac5a2b52f82a",
18
+ "sha256": "b8572efabc3aa0627898ae23fbb7847e5e007fb631217df54d30ac5a2b52f82a"
19
19
  },
20
20
  "catalina": {
21
21
  "cellar": ":any_skip_relocation",
22
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:203eaac0a2c2f18121937d3c065a867a748e7539f8a716d8e55358d626850ec3",
23
- "sha256": "203eaac0a2c2f18121937d3c065a867a748e7539f8a716d8e55358d626850ec3"
22
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:384c3e7c2ce67b2b291774c17da54d0f43ee3b93db3d5f2254c7bbdbbb42213e",
23
+ "sha256": "384c3e7c2ce67b2b291774c17da54d0f43ee3b93db3d5f2254c7bbdbbb42213e"
24
24
  },
25
25
  "mojave": {
26
26
  "cellar": ":any_skip_relocation",
27
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:cc3176e0ed768de2ab13ed28cb41c6efa010382fa2862896c474ff54ce385bfa",
28
- "sha256": "cc3176e0ed768de2ab13ed28cb41c6efa010382fa2862896c474ff54ce385bfa"
27
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:5093e230eccbc34e1d0782ba558bcebb3959af7cb2909a6dbefb0d8db88b4242",
28
+ "sha256": "5093e230eccbc34e1d0782ba558bcebb3959af7cb2909a6dbefb0d8db88b4242"
29
29
  }
30
30
  }
31
31
  }
@@ -35,9 +35,9 @@
35
35
  "system": {
36
36
  "macos": {
37
37
  "catalina": {
38
- "HOMEBREW_VERSION": "3.1.7-36-g7c68b17",
38
+ "HOMEBREW_VERSION": "3.1.9-121-g654c78c",
39
39
  "HOMEBREW_PREFIX": "/usr/local",
40
- "Homebrew/homebrew-core": "b29800c865a59b8b92c4b7e432e6ea736f27dacd",
40
+ "Homebrew/homebrew-core": "053991e1213350e1803bdb6c7c5aca7a36e8e3d0",
41
41
  "CLT": "11.0.0.33.12",
42
42
  "Xcode": "12.4",
43
43
  "macOS": "10.15.7"
@@ -11,7 +11,7 @@ module FastlaneCore
11
11
 
12
12
  class << self
13
13
  # @return The build we waited for. This method will always return a build
14
- def wait_for_build_processing_to_be_complete(app_id: nil, platform: nil, train_version: nil, app_version: nil, build_version: nil, poll_interval: 10, strict_build_watch: false, return_when_build_appears: false, return_spaceship_testflight_build: true, select_latest: false)
14
+ def wait_for_build_processing_to_be_complete(app_id: nil, platform: nil, train_version: nil, app_version: nil, build_version: nil, poll_interval: 10, timeout_duration: nil, strict_build_watch: false, return_when_build_appears: false, return_spaceship_testflight_build: true, select_latest: false)
15
15
  # Warn about train_version being removed in the future
16
16
  if train_version
17
17
  UI.deprecated(":train_version is no longer a used argument on FastlaneCore::BuildWatcher. Please use :app_version instead.")
@@ -26,6 +26,12 @@ module FastlaneCore
26
26
  platform = Spaceship::ConnectAPI::Platform.map(platform) if platform
27
27
  UI.message("Waiting for processing on... app_id: #{app_id}, app_version: #{app_version}, build_version: #{build_version}, platform: #{platform}")
28
28
 
29
+ build_watching_start_time = Time.new
30
+ unless timeout_duration.nil?
31
+ end_time = build_watching_start_time + timeout_duration
32
+ UI.message("Will timeout watching build after #{timeout_duration} seconds around #{end_time}...")
33
+ end
34
+
29
35
  showed_info = false
30
36
  loop do
31
37
  matched_build, app_version_queried = matching_build(watched_app_version: app_version, watched_build_version: build_version, app_id: app_id, platform: platform, select_latest: select_latest)
@@ -56,6 +62,9 @@ module FastlaneCore
56
62
  end
57
63
  end
58
64
 
65
+ # Before next poll, force stop build watching, if we exceeded the 'timeout_duration' waiting time
66
+ force_stop_build_watching_if_required(start_time: build_watching_start_time, timeout_duration: timeout_duration)
67
+
59
68
  sleep(poll_interval)
60
69
  end
61
70
  end
@@ -83,8 +92,8 @@ module FastlaneCore
83
92
 
84
93
  if versions.empty?
85
94
  if select_latest
86
- UI.message("Watched build version should not be present when there is no app version to watch") unless watched_build_version.nil?
87
- UI.message("Searching for the latest build")
95
+ message = watched_build_version.nil? ? "Searching for the latest build" : "Searching for the latest build with build number: #{watched_build_version}"
96
+ UI.message(message)
88
97
  versions = [nil]
89
98
  else
90
99
  raise BuildWatcherError.new, "There is no app version to watch"
@@ -145,6 +154,20 @@ module FastlaneCore
145
154
  UI.message("Waiting for the build to show up in the build list - this may take a few minutes (check your email for processing issues if this continues)")
146
155
  end
147
156
  end
157
+
158
+ def force_stop_build_watching_if_required(start_time: nil, timeout_duration: nil)
159
+ return if start_time.nil? || timeout_duration.nil? # keep watching build for App Store Connect processing
160
+
161
+ current_time = Time.new
162
+ end_time = start_time + timeout_duration
163
+ pending_duration = end_time - current_time
164
+
165
+ if current_time > end_time
166
+ UI.crash!("FastlaneCore::BuildWatcher exceeded the '#{timeout_duration.to_i}' seconds, Stopping now!")
167
+ else
168
+ UI.verbose("Will timeout watching build after pending #{pending_duration.to_i} seconds around #{end_time}...")
169
+ end
170
+ end
148
171
  end
149
172
  end
150
173
  end
@@ -30,6 +30,11 @@ module FastlaneCore
30
30
  type = option.is_string ? String : nil
31
31
  end
32
32
 
33
+ # OptionParser doesn't like symbol but a symbol and string can be easily cast with `to_sym` and `to_s`
34
+ if type == Symbol
35
+ type = String
36
+ end
37
+
33
38
  # Boolean is a fastlane thing, it's either TrueClass, or FalseClass, but we won't know
34
39
  # that until runtime, so nil is the best we get
35
40
  if type == Fastlane::Boolean
@@ -262,6 +262,8 @@ module FastlaneCore
262
262
  return value.to_i if value.to_i.to_s == value.to_s
263
263
  elsif data_type == Float
264
264
  return value.to_f if value.to_f.to_s == value.to_s
265
+ elsif data_type == Symbol
266
+ return value.to_sym if value.to_sym.to_s == value.to_s
265
267
  elsif allow_shell_conversion
266
268
  return value.shelljoin if value.kind_of?(Array)
267
269
  return value.map { |k, v| "#{k.to_s.shellescape}=#{v.shellescape}" }.join(' ') if value.kind_of?(Hash)
@@ -272,11 +274,11 @@ module FastlaneCore
272
274
  rescue JSON::ParserError
273
275
  end
274
276
  elsif data_type != String
275
- # Special treatment if the user specified true, false or YES, NO
277
+ # Special treatment if the user specified true, false, on, off or YES, NO
276
278
  # There is no boolean type, so we just do it here
277
- if %w(YES yes true TRUE).include?(value)
279
+ if %w(yes YES true TRUE on ON).include?(value)
278
280
  return true
279
- elsif %w(NO no false FALSE).include?(value)
281
+ elsif %w(no NO false FALSE off OFF).include?(value)
280
282
  return false
281
283
  end
282
284
  end
@@ -212,7 +212,7 @@ module FastlaneCore
212
212
  # if 'force_ask' is true, the option is not required to be optional to ask
213
213
  # rubocop:disable Metrics/PerceivedComplexity
214
214
  def fetch(key, ask: true, force_ask: false)
215
- UI.crash!("Key '#{key}' must be a symbol. Example :app_id.") unless key.kind_of?(Symbol)
215
+ UI.crash!("Key '#{key}' must be a symbol. Example :#{key}") unless key.kind_of?(Symbol)
216
216
 
217
217
  option = verify_options_key!(key)
218
218
 
@@ -174,6 +174,18 @@ module FastlaneCore
174
174
  Gem::Version.new(installed_xcode_version) >= Gem::Version.new(version)
175
175
  end
176
176
 
177
+ # Swift
178
+ #
179
+
180
+ # @return Swift version
181
+ def self.swift_version
182
+ if system("which swift > /dev/null 2>&1")
183
+ output = `swift --version`
184
+ return output.split("\n").first.match(/version ([0-9.]+)/).captures.first
185
+ end
186
+ return nil
187
+ end
188
+
177
189
  # iTMSTransporter
178
190
  #
179
191
 
@@ -93,15 +93,17 @@ module Match
93
93
  dest_cert_path = File.join(output_dir_certs, "#{cert_name}.cer")
94
94
  dest_p12_path = File.join(output_dir_certs, "#{p12_name}.p12")
95
95
  else
96
- # Need to get the cert id by comparing base64 encoded cert content with certificate content from the API responses
97
- token = api_token(params)
98
- if token
96
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path]))
99
97
  UI.message("Creating authorization token for App Store Connect API")
100
- Spaceship::ConnectAPI.token = token
98
+ Spaceship::ConnectAPI.token = api_token
99
+ elsif !Spaceship::ConnectAPI.token.nil?
100
+ UI.message("Using existing authorization token for App Store Connect API")
101
101
  else
102
102
  UI.message("Login to App Store Connect (#{params[:username]})")
103
103
  Spaceship::ConnectAPI.login(params[:username], use_portal: true, use_tunes: false, portal_team_id: params[:team_id], team_name: params[:team_name])
104
104
  end
105
+
106
+ # Need to get the cert id by comparing base64 encoded cert content with certificate content from the API responses
105
107
  certs = Spaceship::ConnectAPI::Certificate.all(filter: { certificateType: certificate_type })
106
108
 
107
109
  # Base64 encode contents to find match from API to find a cert ID
@@ -147,11 +149,5 @@ module Match
147
149
  UI.user_error!("#{file_description} does not exist at path: #{file_path}") unless !file_path.nil? || optional
148
150
  file_path
149
151
  end
150
-
151
- def api_token(params)
152
- @api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
153
- @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
154
- return @api_token
155
- end
156
152
  end
157
153
  end
@@ -91,9 +91,8 @@ module Match
91
91
  end
92
92
 
93
93
  def api_token(params)
94
- @api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
95
- @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
96
- return @api_token
94
+ api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path])
95
+ return api_token
97
96
  end
98
97
 
99
98
  def ensure_parameters_are_valid(params)
@@ -102,9 +102,11 @@ module Match
102
102
  end
103
103
 
104
104
  def spaceship_login
105
- if api_token
105
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path]))
106
106
  UI.message("Creating authorization token for App Store Connect API")
107
107
  Spaceship::ConnectAPI.token = api_token
108
+ elsif !Spaceship::ConnectAPI.token.nil?
109
+ UI.message("Using existing authorization token for App Store Connect API")
108
110
  else
109
111
  Spaceship::ConnectAPI.login(params[:username], use_portal: true, use_tunes: false, portal_team_id: params[:team_id], team_name: params[:team_name])
110
112
  end
@@ -120,12 +122,6 @@ module Match
120
122
  end
121
123
  end
122
124
 
123
- def api_token
124
- @api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
125
- @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
126
- return @api_token
127
- end
128
-
129
125
  # Collect all the certs/profiles
130
126
  def prepare_list
131
127
  UI.message("Fetching certificates and profiles...")
@@ -207,6 +207,7 @@ module Match
207
207
  FastlaneCore::ConfigItem.new(key: :s3_secret_access_key,
208
208
  env_name: "MATCH_S3_SECRET_ACCESS_KEY",
209
209
  description: "S3 secret access key",
210
+ sensitive: true,
210
211
  optional: true),
211
212
  FastlaneCore::ConfigItem.new(key: :s3_bucket,
212
213
  env_name: "MATCH_S3_BUCKET",
@@ -139,9 +139,8 @@ module Match
139
139
  # rubocop:enable Metrics/PerceivedComplexity
140
140
 
141
141
  def api_token(params)
142
- @api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
143
- @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
144
- return @api_token
142
+ api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path])
143
+ return api_token
145
144
  end
146
145
 
147
146
  # Used when creating a new certificate or profile
@@ -13,6 +13,9 @@ module Match
13
13
  UI.message("Creating authorization token for App Store Connect API")
14
14
  Spaceship::ConnectAPI.token = api_token
15
15
  self.team_id = team_id
16
+ elsif !Spaceship::ConnectAPI.token.nil?
17
+ UI.message("Using existing authorization token for App Store Connect API")
18
+ self.team_id = team_id
16
19
  else
17
20
  # We'll try to manually fetch the password
18
21
  # to tell the user that a password is optional
@@ -123,8 +123,8 @@ module Match
123
123
  end
124
124
 
125
125
  def api_token
126
- api_token ||= Spaceship::ConnectAPI::Token.create(**self.api_key) if self.api_key
127
- api_token ||= Spaceship::ConnectAPI::Token.from_json_file(self.api_key_path) if self.api_key_path
126
+ api_token = Spaceship::ConnectAPI::Token.from(hash: self.api_key, filepath: self.api_key_path)
127
+ api_token ||= Spaceship::ConnectAPI.token
128
128
  return api_token
129
129
  end
130
130
 
@@ -196,8 +196,8 @@ module Match
196
196
  end
197
197
 
198
198
  def api_token
199
- api_token ||= Spaceship::ConnectAPI::Token.create(**self.api_key) if self.api_key
200
- api_token ||= Spaceship::ConnectAPI::Token.from_json_file(self.api_key_path) if self.api_key_path
199
+ api_token = Spaceship::ConnectAPI::Token.from(hash: self.api_key, filepath: self.api_key_path)
200
+ api_token ||= Spaceship::ConnectAPI.token
201
201
  return api_token
202
202
  end
203
203
  end