fastlane 2.156.1 → 2.157.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -80
  3. data/deliver/lib/deliver.rb +1 -0
  4. data/deliver/lib/deliver/app_screenshot_iterator.rb +26 -29
  5. data/deliver/lib/deliver/detect_values.rb +4 -1
  6. data/deliver/lib/deliver/languages.rb +7 -0
  7. data/deliver/lib/deliver/loader.rb +4 -5
  8. data/deliver/lib/deliver/runner.rb +7 -5
  9. data/deliver/lib/deliver/upload_screenshots.rb +34 -17
  10. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +120 -0
  11. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -0
  13. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +17 -1
  14. data/fastlane/lib/fastlane/actions/set_changelog.rb +2 -2
  15. data/fastlane/lib/fastlane/actions/sonar.rb +5 -0
  16. data/fastlane/lib/fastlane/actions/spaceship_stats.rb +73 -0
  17. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +4 -0
  18. data/fastlane/lib/fastlane/version.rb +1 -1
  19. data/fastlane/swift/Deliverfile.swift +1 -1
  20. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  21. data/fastlane/swift/Fastlane.swift +68 -8
  22. data/fastlane/swift/Gymfile.swift +1 -1
  23. data/fastlane/swift/GymfileProtocol.swift +1 -1
  24. data/fastlane/swift/Matchfile.swift +1 -1
  25. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  26. data/fastlane/swift/Precheckfile.swift +1 -1
  27. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  28. data/fastlane/swift/Scanfile.swift +1 -1
  29. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  30. data/fastlane/swift/Screengrabfile.swift +1 -1
  31. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  32. data/fastlane/swift/Snapshotfile.swift +1 -1
  33. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  34. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +71 -42
  35. data/gym/lib/gym/error_handler.rb +1 -1
  36. data/pilot/lib/pilot/build_manager.rb +18 -4
  37. data/pilot/lib/pilot/manager.rb +15 -5
  38. data/pilot/lib/pilot/options.rb +16 -0
  39. data/produce/lib/produce/itunes_connect.rb +2 -2
  40. data/screengrab/lib/screengrab/runner.rb +1 -0
  41. data/sigh/lib/sigh/runner.rb +4 -4
  42. data/spaceship/lib/spaceship.rb +4 -0
  43. data/spaceship/lib/spaceship/client.rb +2 -0
  44. data/spaceship/lib/spaceship/connect_api.rb +0 -15
  45. data/spaceship/lib/spaceship/connect_api/api_client.rb +270 -0
  46. data/spaceship/lib/spaceship/connect_api/client.rb +139 -213
  47. data/spaceship/lib/spaceship/connect_api/provisioning/client.rb +8 -17
  48. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +75 -64
  49. data/spaceship/lib/spaceship/connect_api/spaceship.rb +94 -0
  50. data/spaceship/lib/spaceship/connect_api/testflight/client.rb +8 -17
  51. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +288 -277
  52. data/spaceship/lib/spaceship/connect_api/token.rb +46 -5
  53. data/spaceship/lib/spaceship/connect_api/token_refresh_middleware.rb +24 -0
  54. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +8 -17
  55. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +717 -706
  56. data/spaceship/lib/spaceship/connect_api/users/client.rb +8 -17
  57. data/spaceship/lib/spaceship/connect_api/users/users.rb +28 -17
  58. data/spaceship/lib/spaceship/stats_middleware.rb +65 -0
  59. metadata +25 -19
  60. data/spaceship/lib/spaceship/connect_api/.client.rb.swp +0 -0
@@ -14,4 +14,4 @@ class Gymfile: GymfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.156.1
17
+ // Generated with fastlane 2.157.0
@@ -181,4 +181,4 @@ extension GymfileProtocol {
181
181
 
182
182
  // Please don't remove the lines below
183
183
  // They are used to detect outdated files
184
- // FastlaneRunnerAPIVersion [0.9.37]
184
+ // FastlaneRunnerAPIVersion [0.9.38]
@@ -14,4 +14,4 @@ class Matchfile: MatchfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.156.1
17
+ // Generated with fastlane 2.157.0
@@ -165,4 +165,4 @@ extension MatchfileProtocol {
165
165
 
166
166
  // Please don't remove the lines below
167
167
  // They are used to detect outdated files
168
- // FastlaneRunnerAPIVersion [0.9.31]
168
+ // FastlaneRunnerAPIVersion [0.9.32]
@@ -14,4 +14,4 @@ class Precheckfile: PrecheckfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.156.1
17
+ // Generated with fastlane 2.157.0
@@ -33,4 +33,4 @@ extension PrecheckfileProtocol {
33
33
 
34
34
  // Please don't remove the lines below
35
35
  // They are used to detect outdated files
36
- // FastlaneRunnerAPIVersion [0.9.30]
36
+ // FastlaneRunnerAPIVersion [0.9.31]
@@ -14,4 +14,4 @@ class Scanfile: ScanfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.156.1
17
+ // Generated with fastlane 2.157.0
@@ -257,4 +257,4 @@ extension ScanfileProtocol {
257
257
 
258
258
  // Please don't remove the lines below
259
259
  // They are used to detect outdated files
260
- // FastlaneRunnerAPIVersion [0.9.42]
260
+ // FastlaneRunnerAPIVersion [0.9.43]
@@ -14,4 +14,4 @@ class Screengrabfile: ScreengrabfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.156.1
17
+ // Generated with fastlane 2.157.0
@@ -93,4 +93,4 @@ extension ScreengrabfileProtocol {
93
93
 
94
94
  // Please don't remove the lines below
95
95
  // They are used to detect outdated files
96
- // FastlaneRunnerAPIVersion [0.9.32]
96
+ // FastlaneRunnerAPIVersion [0.9.33]
@@ -14,4 +14,4 @@ class Snapshotfile: SnapshotfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.156.1
17
+ // Generated with fastlane 2.157.0
@@ -181,4 +181,4 @@ extension SnapshotfileProtocol {
181
181
 
182
182
  // Please don't remove the lines below
183
183
  // They are used to detect outdated files
184
- // FastlaneRunnerAPIVersion [0.9.26]
184
+ // FastlaneRunnerAPIVersion [0.9.27]
@@ -170,38 +170,44 @@ module FastlaneCore
170
170
 
171
171
  # Generates commands and executes the iTMSTransporter through the shell script it provides by the same name
172
172
  class ShellScriptTransporterExecutor < TransporterExecutor
173
- def build_upload_command(username, password, source = "/tmp", provider_short_name = "")
173
+ def build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil)
174
+ use_jwt = !jwt.to_s.empty?
174
175
  [
175
176
  '"' + Helper.transporter_path + '"',
176
177
  "-m upload",
177
- "-u #{username.shellescape}",
178
- "-p #{shell_escaped_password(password)}",
178
+ ("-u #{username.shellescape}" unless use_jwt),
179
+ ("-p #{shell_escaped_password(password)}" unless use_jwt),
180
+ ("-jwt #{jwt}" if use_jwt),
179
181
  "-f \"#{source}\"",
180
182
  additional_upload_parameters, # that's here, because the user might overwrite the -t option
181
183
  "-k 100000",
182
184
  ("-WONoPause true" if Helper.windows?), # Windows only: process instantly returns instead of waiting for key press
183
- ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?)
185
+ ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?)
184
186
  ].compact.join(' ')
185
187
  end
186
188
 
187
- def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "")
189
+ def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil)
190
+ use_jwt = !jwt.to_s.empty?
188
191
  [
189
192
  '"' + Helper.transporter_path + '"',
190
193
  "-m lookupMetadata",
191
- "-u #{username.shellescape}",
192
- "-p #{shell_escaped_password(password)}",
194
+ ("-u #{username.shellescape}" unless use_jwt),
195
+ ("-p #{shell_escaped_password(password)}" unless use_jwt),
196
+ ("-jwt #{jwt}" if use_jwt),
193
197
  "-apple_id #{apple_id}",
194
198
  "-destination '#{destination}'",
195
- ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?)
199
+ ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?)
196
200
  ].compact.join(' ')
197
201
  end
198
202
 
199
- def build_provider_ids_command(username, password)
203
+ def build_provider_ids_command(username, password, jwt = nil)
204
+ use_jwt = !jwt.to_s.empty?
200
205
  [
201
206
  '"' + Helper.transporter_path + '"',
202
207
  '-m provider',
203
- "-u \"#{username}\"",
204
- "-p #{shell_escaped_password(password)}"
208
+ ("-u \"#{username.shellescape}\"" unless use_jwt),
209
+ ("-p #{shell_escaped_password(password)}" unless use_jwt),
210
+ ("-jwt #{jwt}" if use_jwt)
205
211
  ].compact.join(' ')
206
212
  end
207
213
 
@@ -246,18 +252,20 @@ module FastlaneCore
246
252
  # Generates commands and executes the iTMSTransporter by invoking its Java app directly, to avoid the crazy parameter
247
253
  # escaping problems in its accompanying shell script.
248
254
  class JavaTransporterExecutor < TransporterExecutor
249
- def build_upload_command(username, password, source = "/tmp", provider_short_name = "")
255
+ def build_upload_command(username, password, source = "/tmp", provider_short_name = "", jwt = nil)
256
+ use_jwt = !jwt.to_s.empty?
250
257
  if Helper.mac? && Helper.xcode_at_least?(11)
251
258
  [
252
- "ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}",
259
+ ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" unless use_jwt),
253
260
  'xcrun iTMSTransporter',
254
261
  '-m upload',
255
- "-u #{username.shellescape}",
256
- "-p @env:ITMS_TRANSPORTER_PASSWORD",
262
+ ("-u #{username.shellescape}" unless use_jwt),
263
+ ("-p @env:ITMS_TRANSPORTER_PASSWORD" unless use_jwt),
264
+ ("-jwt #{jwt}" if use_jwt),
257
265
  "-f #{source.shellescape}",
258
266
  additional_upload_parameters, # that's here, because the user might overwrite the -t option
259
267
  '-k 100000',
260
- ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
268
+ ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?),
261
269
  '2>&1' # cause stderr to be written to stdout
262
270
  ].compact.join(' ') # compact gets rid of the possibly nil ENV value
263
271
  else
@@ -272,28 +280,31 @@ module FastlaneCore
272
280
  '-Dsun.net.http.retryPost=false',
273
281
  java_code_option,
274
282
  '-m upload',
275
- "-u #{username.shellescape}",
276
- "-p #{password.shellescape}",
283
+ ("-u #{username.shellescape}" unless use_jwt),
284
+ ("-p #{password.shellescape}" unless use_jwt),
285
+ ("-jwt #{jwt}" if use_jwt),
277
286
  "-f #{source.shellescape}",
278
287
  additional_upload_parameters, # that's here, because the user might overwrite the -t option
279
288
  '-k 100000',
280
- ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
289
+ ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?),
281
290
  '2>&1' # cause stderr to be written to stdout
282
291
  ].compact.join(' ') # compact gets rid of the possibly nil ENV value
283
292
  end
284
293
  end
285
294
 
286
- def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "")
295
+ def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil)
296
+ use_jwt = !jwt.to_s.empty?
287
297
  if Helper.mac? && Helper.xcode_at_least?(11)
288
298
  [
289
- "ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}",
299
+ ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" unless use_jwt),
290
300
  'xcrun iTMSTransporter',
291
301
  '-m lookupMetadata',
292
- "-u #{username.shellescape}",
293
- "-p @env:ITMS_TRANSPORTER_PASSWORD",
302
+ ("-u #{username.shellescape}" unless use_jwt),
303
+ ("-p @env:ITMS_TRANSPORTER_PASSWORD" unless use_jwt),
304
+ ("-jwt #{jwt}" if use_jwt),
294
305
  "-apple_id #{apple_id.shellescape}",
295
306
  "-destination #{destination.shellescape}",
296
- ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
307
+ ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?),
297
308
  '2>&1' # cause stderr to be written to stdout
298
309
  ].compact.join(' ')
299
310
  else
@@ -308,24 +319,27 @@ module FastlaneCore
308
319
  '-Dsun.net.http.retryPost=false',
309
320
  java_code_option,
310
321
  '-m lookupMetadata',
311
- "-u #{username.shellescape}",
312
- "-p #{password.shellescape}",
322
+ ("-u #{username.shellescape}" unless use_jwt),
323
+ ("-p #{password.shellescape}" unless use_jwt),
324
+ ("-jwt #{jwt}" if use_jwt),
313
325
  "-apple_id #{apple_id.shellescape}",
314
326
  "-destination #{destination.shellescape}",
315
- ("-itc_provider #{provider_short_name}" unless provider_short_name.to_s.empty?),
327
+ ("-itc_provider #{provider_short_name}" if jwt.nil? && !provider_short_name.to_s.empty?),
316
328
  '2>&1' # cause stderr to be written to stdout
317
329
  ].compact.join(' ')
318
330
  end
319
331
  end
320
332
 
321
- def build_provider_ids_command(username, password)
333
+ def build_provider_ids_command(username, password, jwt = nil)
334
+ use_jwt = !jwt.to_s.empty?
322
335
  if Helper.mac? && Helper.xcode_at_least?(11)
323
336
  [
324
- "ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}",
337
+ ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" unless use_jwt),
325
338
  'xcrun iTMSTransporter',
326
339
  '-m provider',
327
- "-u #{username.shellescape}",
328
- "-p @env:ITMS_TRANSPORTER_PASSWORD",
340
+ ("-u #{username.shellescape}" unless use_jwt),
341
+ ("-p @env:ITMS_TRANSPORTER_PASSWORD" unless use_jwt),
342
+ ("-jwt #{jwt}" if use_jwt),
329
343
  '2>&1' # cause stderr to be written to stdout
330
344
  ].compact.join(' ')
331
345
  else
@@ -340,8 +354,9 @@ module FastlaneCore
340
354
  '-Dsun.net.http.retryPost=false',
341
355
  java_code_option,
342
356
  '-m provider',
343
- "-u #{username.shellescape}",
344
- "-p #{password.shellescape}",
357
+ ("-u #{username.shellescape}" unless use_jwt),
358
+ ("-p #{password.shellescape}" unless use_jwt),
359
+ ("-jwt #{jwt}" if use_jwt),
345
360
  '2>&1' # cause stderr to be written to stdout
346
361
  ].compact.join(' ')
347
362
  end
@@ -399,15 +414,19 @@ module FastlaneCore
399
414
  # see: https://github.com/fastlane/fastlane/issues/1524#issuecomment-196370628
400
415
  # for more information about how to use the iTMSTransporter to list your provider
401
416
  # short names
402
- def initialize(user = nil, password = nil, use_shell_script = false, provider_short_name = nil)
417
+ def initialize(user = nil, password = nil, use_shell_script = false, provider_short_name = nil, jwt = nil)
403
418
  # Xcode 6.x doesn't have the same iTMSTransporter Java setup as later Xcode versions, so
404
419
  # we can't default to using the newer direct Java invocation strategy for those versions.
405
420
  use_shell_script ||= Helper.is_mac? && Helper.xcode_version.start_with?('6.')
406
421
  use_shell_script ||= Helper.windows?
407
422
  use_shell_script ||= Feature.enabled?('FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT')
408
423
 
409
- @user = user
410
- @password = password || load_password_for_transporter
424
+ if jwt.to_s.empty?
425
+ @user = user
426
+ @password = password || load_password_for_transporter
427
+ end
428
+
429
+ @jwt = jwt
411
430
 
412
431
  @transporter_executor = use_shell_script ? ShellScriptTransporterExecutor.new : JavaTransporterExecutor.new
413
432
  @provider_short_name = provider_short_name
@@ -422,9 +441,12 @@ module FastlaneCore
422
441
  def download(app_id, dir = nil)
423
442
  dir ||= "/tmp"
424
443
 
444
+ password_placeholder = @jwt.nil? ? 'YourPassword' : nil
445
+ jwt_placeholder = @jwt.nil? ? nil : 'YourJWT'
446
+
425
447
  UI.message("Going to download app metadata from App Store Connect")
426
- command = @transporter_executor.build_download_command(@user, @password, app_id, dir, @provider_short_name)
427
- UI.verbose(@transporter_executor.build_download_command(@user, 'YourPassword', app_id, dir, @provider_short_name))
448
+ command = @transporter_executor.build_download_command(@user, @password, app_id, dir, @provider_short_name, @jwt)
449
+ UI.verbose(@transporter_executor.build_download_command(@user, password_placeholder, app_id, dir, @provider_short_name, jwt_placeholder))
428
450
 
429
451
  begin
430
452
  result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
@@ -459,8 +481,11 @@ module FastlaneCore
459
481
  UI.message("Going to upload updated app to App Store Connect")
460
482
  UI.success("This might take a few minutes. Please don't interrupt the script.")
461
483
 
462
- command = @transporter_executor.build_upload_command(@user, @password, actual_dir, @provider_short_name)
463
- UI.verbose(@transporter_executor.build_upload_command(@user, 'YourPassword', actual_dir, @provider_short_name))
484
+ password_placeholder = @jwt.nil? ? 'YourPassword' : nil
485
+ jwt_placeholder = @jwt.nil? ? nil : 'YourJWT'
486
+
487
+ command = @transporter_executor.build_upload_command(@user, @password, actual_dir, @provider_short_name, @jwt)
488
+ UI.verbose(@transporter_executor.build_upload_command(@user, password_placeholder, actual_dir, @provider_short_name, jwt_placeholder))
464
489
 
465
490
  begin
466
491
  result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
@@ -481,8 +506,12 @@ module FastlaneCore
481
506
  end
482
507
 
483
508
  def provider_ids
484
- command = @transporter_executor.build_provider_ids_command(@user, @password)
485
- UI.verbose(@transporter_executor.build_provider_ids_command(@user, 'YourPassword'))
509
+ password_placeholder = @jwt.nil? ? 'YourPassword' : nil
510
+ jwt_placeholder = @jwt.nil? ? nil : 'YourJWT'
511
+
512
+ command = @transporter_executor.build_provider_ids_command(@user, @password, @jwt)
513
+ UI.verbose(@transporter_executor.build_provider_ids_command(@user, password_placeholder, jwt_placeholder))
514
+
486
515
  lines = []
487
516
  begin
488
517
  result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?) { |xs| lines = xs }
@@ -143,7 +143,7 @@ module Gym
143
143
  # `xcodebuild` doesn't properly mark lines as failure reason or important information
144
144
  # so we assume that the last few lines show the error message that's relevant
145
145
  # (at least that's what was correct during testing)
146
- log_content = File.read(log_path).split("\n")[-5..-1]
146
+ log_content = File.read(log_path).split("\n").last(5)
147
147
  log_content.each do |row|
148
148
  UI.command_output(row)
149
149
  end
@@ -343,22 +343,36 @@ module Pilot
343
343
  builds_to_expire.each(&:expire!)
344
344
  end
345
345
 
346
+ # If App Store Connect API token, use token.
346
347
  # If itc_provider was explicitly specified, use it.
347
348
  # If there are multiple teams, infer the provider from the selected team name.
348
349
  # If there are fewer than two teams, don't infer the provider.
349
350
  def transporter_for_selected_team(options)
351
+ # Use JWT auth
352
+ unless api_token.nil?
353
+ api_token.refresh! if api_token.expired?
354
+ return FastlaneCore::ItunesTransporter.new(nil, nil, false, nil, api_token.text)
355
+ end
356
+
357
+ # Otherwise use username and password
358
+ tunes_client = Spaceship::ConnectAPI.client ? Spaceship::ConnectAPI.client.tunes_client : nil
359
+
350
360
  generic_transporter = FastlaneCore::ItunesTransporter.new(options[:username], nil, false, options[:itc_provider])
351
- return generic_transporter if options[:itc_provider] || Spaceship::Tunes.client.nil?
352
- return generic_transporter unless Spaceship::Tunes.client.teams.count > 1
361
+ return generic_transporter if options[:itc_provider] || tunes_client.nil?
362
+ return generic_transporter unless tunes_client.teams.count > 1
353
363
 
354
364
  begin
355
- team = Spaceship::Tunes.client.teams.find { |t| t['contentProvider']['contentProviderId'].to_s == Spaceship::Tunes.client.team_id }
365
+ team = tunes_client.teams.find { |t| t['contentProvider']['contentProviderId'].to_s == tunes_client.team_id }
356
366
  name = team['contentProvider']['name']
367
+ STDERR.puts("name: #{name}")
368
+ STDERR.puts("id: #{generic_transporter.provider_ids}")
357
369
  provider_id = generic_transporter.provider_ids[name]
370
+ STDERR.puts("provider_id: #{provider_id}")
358
371
  UI.verbose("Inferred provider id #{provider_id} for team #{name}.")
359
372
  return FastlaneCore::ItunesTransporter.new(options[:username], nil, false, provider_id)
360
373
  rescue => ex
361
- UI.verbose("Couldn't infer a provider short name for team with id #{Spaceship::Tunes.client.team_id} automatically: #{ex}. Proceeding without provider short name.")
374
+ STDERR.puts(ex.to_s)
375
+ UI.verbose("Couldn't infer a provider short name for team with id #{tunes_client.team_id} automatically: #{ex}. Proceeding without provider short name.")
362
376
  return generic_transporter
363
377
  end
364
378
  end
@@ -17,12 +17,22 @@ module Pilot
17
17
  end
18
18
 
19
19
  def login
20
- config[:username] ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
20
+ if api_token
21
+ UI.message("Creating authorization token for App Store Connect API")
22
+ Spaceship::ConnectAPI.token = api_token
23
+ else
24
+ config[:username] ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
21
25
 
22
- UI.message("Login to App Store Connect (#{config[:username]})")
23
- Spaceship::Tunes.login(config[:username])
24
- Spaceship::Tunes.select_team(team_id: config[:team_id], team_name: config[:team_name])
25
- UI.message("Login successful")
26
+ UI.message("Login to App Store Connect (#{config[:username]})")
27
+ Spaceship::ConnectAPI.login(config[:username], team_id: config[:team_id], team_name: config[:team_name])
28
+ UI.message("Login successful")
29
+ end
30
+ end
31
+
32
+ def api_token
33
+ @api_token ||= Spaceship::ConnectAPI::Token.create(config[:api_key]) if config[:api_key]
34
+ @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(config[:api_key_path]) if config[:api_key_path]
35
+ return @api_token
26
36
  end
27
37
 
28
38
  # The app object we're currently using
@@ -10,6 +10,22 @@ module Pilot
10
10
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
11
11
 
12
12
  [
13
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
14
+ env_name: "PILOT_API_KEY_PATH",
15
+ description: "Path to your App Store Connect API key JSON file",
16
+ optional: true,
17
+ conflicting_options: [:username],
18
+ verify_block: proc do |value|
19
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
20
+ end),
21
+ FastlaneCore::ConfigItem.new(key: :api_key,
22
+ env_name: "PILOT_API_KEY",
23
+ description: "Path to your App Store Connect API key JSON file",
24
+ type: Hash,
25
+ optional: true,
26
+ sensitive: true,
27
+ conflicting_options: [:api_key_path, :username]),
28
+
13
29
  # app upload info
14
30
  FastlaneCore::ConfigItem.new(key: :username,
15
31
  short_option: "-u",
@@ -9,8 +9,8 @@ module Produce
9
9
  @full_bundle_identifier = app_identifier
10
10
  @full_bundle_identifier.gsub!('*', Produce.config[:bundle_identifier_suffix].to_s) if wildcard_bundle?
11
11
 
12
- Spaceship::Tunes.login(Produce.config[:username], nil)
13
- Spaceship::Tunes.client.select_team
12
+ Spaceship::ConnectAPI.login(Produce.config[:username], nil)
13
+ Spaceship::ConnectAPI.client.select_team
14
14
 
15
15
  create_new_app
16
16
  end
@@ -64,6 +64,7 @@ module Screengrab
64
64
  # Root is needed to access device paths at /data
65
65
  if @config[:use_adb_root]
66
66
  run_adb_command("-s #{device_serial} root", print_all: false, print_command: true)
67
+ run_adb_command("-s #{device_serial} wait-for-device", print_all: false, print_command: true)
67
68
  end
68
69
 
69
70
  clear_device_previous_screenshots(@config[:app_package_name], device_serial, device_screenshots_paths)
@@ -18,8 +18,8 @@ module Sigh
18
18
  title: "Summary for sigh #{Fastlane::VERSION}")
19
19
 
20
20
  UI.message("Starting login with user '#{Sigh.config[:username]}'")
21
- Spaceship.login(Sigh.config[:username], nil)
22
- Spaceship.select_team
21
+ Spaceship::ConnectAPI.login(Sigh.config[:username], nil)
22
+ Spaceship::ConnectAPI.select_team
23
23
  UI.message("Successfully logged in")
24
24
 
25
25
  profiles = [] if Sigh.config[:skip_fetch_profiles]
@@ -60,12 +60,12 @@ module Sigh
60
60
  case Sigh.config[:platform]
61
61
  when "ios"
62
62
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_STORE
63
- @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_INHOUSE if Spaceship.client.in_house?
63
+ @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_INHOUSE if Spaceship::ConnectAPI.client.in_house?
64
64
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_ADHOC if Sigh.config[:adhoc]
65
65
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_DEVELOPMENT if Sigh.config[:development]
66
66
  when "tvos"
67
67
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_STORE
68
- @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_INHOUSE if Spaceship.client.in_house?
68
+ @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_INHOUSE if Spaceship::ConnectAPI.client.in_house?
69
69
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_ADHOC if Sigh.config[:adhoc]
70
70
  @profile_type = Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_DEVELOPMENT if Sigh.config[:development]
71
71
  when "macos"