fastlane 2.161.0 → 2.166.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +78 -78
  3. data/cert/lib/cert/options.rb +28 -1
  4. data/cert/lib/cert/runner.rb +51 -34
  5. data/deliver/lib/deliver/.upload_screenshots.rb.swp +0 -0
  6. data/deliver/lib/deliver/app_screenshot_iterator.rb +4 -4
  7. data/deliver/lib/deliver/module.rb +2 -0
  8. data/deliver/lib/deliver/options.rb +5 -5
  9. data/deliver/lib/deliver/queue_worker.rb +14 -29
  10. data/deliver/lib/deliver/upload_metadata.rb +20 -5
  11. data/deliver/lib/deliver/upload_screenshots.rb +28 -13
  12. data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
  13. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  14. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +39 -3
  15. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +9 -0
  16. data/fastlane/lib/fastlane/actions/appledoc.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +1 -0
  18. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +5 -1
  19. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +9 -0
  20. data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -0
  21. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -0
  22. data/fastlane/lib/fastlane/actions/import_from_git.rb +9 -1
  23. data/fastlane/lib/fastlane/actions/is_ci.rb +1 -1
  24. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +15 -0
  25. data/fastlane/lib/fastlane/actions/register_device.rb +46 -5
  26. data/fastlane/lib/fastlane/actions/register_devices.rb +50 -16
  27. data/fastlane/lib/fastlane/actions/set_changelog.rb +31 -3
  28. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +1 -0
  29. data/fastlane/lib/fastlane/actions/update_fastlane.rb +24 -8
  30. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -2
  31. data/fastlane/lib/fastlane/cli_tools_distributor.rb +1 -1
  32. data/fastlane/lib/fastlane/fast_file.rb +74 -23
  33. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -0
  34. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  35. data/fastlane/lib/fastlane/version.rb +1 -1
  36. data/fastlane/swift/Deliverfile.swift +1 -1
  37. data/fastlane/swift/DeliverfileProtocol.swift +4 -4
  38. data/fastlane/swift/Fastlane.swift +119 -23
  39. data/fastlane/swift/Gymfile.swift +1 -1
  40. data/fastlane/swift/GymfileProtocol.swift +1 -1
  41. data/fastlane/swift/LaneFileProtocol.swift +15 -19
  42. data/fastlane/swift/MainProcess.swift +1 -1
  43. data/fastlane/swift/Matchfile.swift +1 -1
  44. data/fastlane/swift/MatchfileProtocol.swift +20 -4
  45. data/fastlane/swift/Precheckfile.swift +1 -1
  46. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  47. data/fastlane/swift/Scanfile.swift +1 -1
  48. data/fastlane/swift/ScanfileProtocol.swift +5 -1
  49. data/fastlane/swift/Screengrabfile.swift +1 -1
  50. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  51. data/fastlane/swift/Snapshotfile.swift +1 -1
  52. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  53. data/fastlane/swift/main.swift +1 -1
  54. data/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb +6 -7
  55. data/fastlane_core/lib/fastlane_core/device_manager.rb +8 -4
  56. data/fastlane_core/lib/fastlane_core/helper.rb +10 -2
  57. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -3
  58. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +3 -3
  59. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  60. data/match/lib/match/generator.rb +6 -1
  61. data/match/lib/match/importer.rb +63 -18
  62. data/match/lib/match/migrate.rb +13 -2
  63. data/match/lib/match/nuke.rb +65 -22
  64. data/match/lib/match/options.rb +33 -2
  65. data/match/lib/match/runner.rb +38 -10
  66. data/match/lib/match/spaceship_ensure.rb +27 -21
  67. data/match/lib/match/storage/google_cloud_storage.rb +20 -3
  68. data/match/lib/match/storage/s3_storage.rb +19 -3
  69. data/scan/lib/scan/detect_values.rb +8 -9
  70. data/scan/lib/scan/module.rb +4 -0
  71. data/scan/lib/scan/options.rb +9 -0
  72. data/scan/lib/scan/runner.rb +2 -1
  73. data/sigh/lib/assets/resign.sh +1 -1
  74. data/sigh/lib/sigh/download_all.rb +16 -4
  75. data/sigh/lib/sigh/options.rb +21 -0
  76. data/sigh/lib/sigh/runner.rb +83 -41
  77. data/snapshot/lib/assets/SnapshotHelper.swift +4 -0
  78. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
  79. data/snapshot/lib/snapshot/test_command_generator.rb +1 -1
  80. data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
  81. data/snapshot/lib/snapshot/test_command_generator_xcode_8.rb +1 -1
  82. data/spaceship/lib/spaceship/client.rb +9 -4
  83. data/spaceship/lib/spaceship/connect_api.rb +27 -0
  84. data/spaceship/lib/spaceship/connect_api/api_client.rb +12 -3
  85. data/spaceship/lib/spaceship/connect_api/client.rb +20 -7
  86. data/spaceship/lib/spaceship/connect_api/models/app.rb +51 -0
  87. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +3 -1
  88. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +2 -1
  89. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +42 -0
  90. data/spaceship/lib/spaceship/connect_api/models/custom_app_organization.rb +43 -0
  91. data/spaceship/lib/spaceship/connect_api/models/custom_app_user.rb +41 -0
  92. data/spaceship/lib/spaceship/connect_api/models/device.rb +5 -0
  93. data/spaceship/lib/spaceship/connect_api/models/profile.rb +7 -1
  94. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +59 -0
  95. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +45 -2
  96. data/spaceship/lib/spaceship/connect_api/spaceship.rb +7 -4
  97. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  98. data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
  99. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +71 -0
  100. data/spaceship/lib/spaceship/connect_api/users/users.rb +40 -0
  101. data/supply/lib/supply.rb +1 -1
  102. data/supply/lib/supply/uploader.rb +1 -1
  103. metadata +24 -18
@@ -106,7 +106,7 @@ app.launch()
106
106
 
107
107
  ```objective-c
108
108
  XCUIApplication *app = [[XCUIApplication alloc] init];
109
- [Snapshot setupSnapshot:app];
109
+ [Snapshot setupSnapshot:app waitForAnimations:NO];
110
110
  [app launch];
111
111
  ```
112
112
 
@@ -282,6 +282,10 @@ launch_arguments([
282
282
  ])
283
283
  ```
284
284
 
285
+ ## Xcode Environment Variables
286
+
287
+ _snapshot_ includes `FASTLANE_SNAPSHOT=YES` and `FASTLANE_LANGUAGE=<language>` as arguments when executing `xcodebuild`. This means you may use these environment variables in a custom build phase run script to do any additional configuration.
288
+
285
289
  # How does it work?
286
290
 
287
291
  The easiest solution would be to just render the UIWindow into a file. That's not possible because UI Tests don't run on a main thread. So _snapshot_ uses a different approach:
@@ -492,6 +492,15 @@ fastlane match import
492
492
 
493
493
  You'll be prompted for the certificate (`.cer`), the private key (`.p12`) and the provisioning profiles (`.mobileprovision` or `.provisionprofile`) paths. _match_ will first validate the certificate (`.cer`) against the Developer Portal before importing the certificate, the private key and the provisioning profiles into the specified _match_ repository.
494
494
 
495
+ However if there is no access to the developer portal but there are certificates, private keys and profiles provided, you can use the `skip_certificate_matching` option to tell _match_ not to verify the certificates. Like this:
496
+
497
+ ```no-highlight
498
+ fastlane match import --skip_certificate_matching true
499
+ ```
500
+ This will skip login to Apple Developer Portal and will import the provided certificate, private key and profile directly to the certificates repo.
501
+
502
+ Please be careful when using this option and ensure the certificates and profiles match the type (development, adhoc, appstore, enterprise, developer_id) and are not revoked or expired.
503
+
495
504
  ### Manual Decrypt
496
505
 
497
506
  If you want to manually decrypt a file you can.
@@ -13,6 +13,7 @@ module Fastlane
13
13
 
14
14
  begin
15
15
  Cert.config = params # we alread have the finished config
16
+ Cert.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
16
17
 
17
18
  Cert::Runner.new.launch
18
19
  cert_file_path = ENV["CER_FILE_PATH"]
@@ -15,6 +15,7 @@ module Fastlane
15
15
  require 'credentials_manager/appfile_config'
16
16
 
17
17
  Sigh.config = values # we already have the finished config
18
+ Sigh.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
18
19
 
19
20
  path = Sigh::Manager.start
20
21
 
@@ -19,6 +19,9 @@ module Fastlane
19
19
 
20
20
  def self.available_options
21
21
  [
22
+ # Because the `run` method is actually implemented in `fast_file.rb`,
23
+ # and because magic, some of the parameters on `ConfigItem`s (e.g.
24
+ # `conflicting_options`, `verify_block`) are completely ignored.
22
25
  FastlaneCore::ConfigItem.new(key: :url,
23
26
  description: "The URL of the repository to import the Fastfile from",
24
27
  default_value: nil),
@@ -38,6 +41,10 @@ module Fastlane
38
41
  description: "The version to checkout on the repository. Optimistic match operator or multiple conditions can be used to select the latest version within constraints",
39
42
  default_value: nil,
40
43
  is_string: false,
44
+ optional: true),
45
+ FastlaneCore::ConfigItem.new(key: :cache_path,
46
+ description: "The path to a directory where the repository should be cloned into. This is ignored if `version` is not specified. Defaults to `nil`, which causes the repository to be cloned on every call, to a temporary directory",
47
+ default_value: nil,
41
48
  optional: true)
42
49
  ]
43
50
  end
@@ -62,7 +69,8 @@ module Fastlane
62
69
  url: "git@github.com:fastlane/fastlane.git", # The URL of the repository to import the Fastfile from.
63
70
  branch: "HEAD", # The branch to checkout on the repository
64
71
  path: "fastlane/Fastfile", # The path of the Fastfile in the repository
65
- version: [">= 1.1.0", "< 2.0.0"] # The version to checkout on the repository. Multiple conditions can be used to select the latest version within constraints.
72
+ version: [">= 1.1.0", "< 2.0.0"], # The version to checkout on the repository. Multiple conditions can be used to select the latest version within constraints.
73
+ cache_path: "~/.cache/fastlane/imported" # A directory in which the repository will be added, which means that it will not be cloned again on subsequent calls.
66
74
  )'
67
75
  ]
68
76
  end
@@ -35,7 +35,7 @@ module Fastlane
35
35
 
36
36
  def self.example_code
37
37
  [
38
- 'if is_ci?
38
+ 'if is_ci
39
39
  puts "I\'m a computer"
40
40
  else
41
41
  say "Hi Human!"
@@ -37,6 +37,21 @@ module Fastlane
37
37
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
38
38
 
39
39
  [
40
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
41
+ env_name: "APPSTORE_BUILD_NUMBER_API_KEY_PATH",
42
+ description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
43
+ optional: true,
44
+ conflicting_options: [:api_key],
45
+ verify_block: proc do |value|
46
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
47
+ end),
48
+ FastlaneCore::ConfigItem.new(key: :api_key,
49
+ env_name: "APPSTORE_BUILD_NUMBER_API_KEY",
50
+ description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)",
51
+ type: Hash,
52
+ optional: true,
53
+ sensitive: true,
54
+ conflicting_options: [:api_key_path]),
40
55
  FastlaneCore::ConfigItem.new(key: :live,
41
56
  short_option: "-l",
42
57
  env_name: "CURRENT_BUILD_NUMBER_LIVE",
@@ -11,23 +11,39 @@ module Fastlane
11
11
  require 'spaceship'
12
12
 
13
13
  name = params[:name]
14
+ platform = params[:platform]
14
15
  udid = params[:udid]
15
16
 
16
- credentials = CredentialsManager::AccountManager.new(user: params[:username])
17
- Spaceship.login(credentials.user, credentials.password)
18
- Spaceship.select_team
17
+ platform = Spaceship::ConnectAPI::BundleIdPlatform.map(platform)
18
+
19
+ if (token = api_token(params))
20
+ UI.message("Using App Store Connect API token...")
21
+ Spaceship::ConnectAPI.token = token
22
+ else
23
+ UI.message("Login to App Store Connect (#{params[:username]})")
24
+ credentials = CredentialsManager::AccountManager.new(user: params[:username])
25
+ Spaceship::ConnectAPI.login(credentials.user, credentials.password, use_portal: true, use_tunes: false)
26
+ UI.message("Login successful")
27
+ end
19
28
 
20
29
  begin
21
- Spaceship::Device.create!(name: name, udid: udid)
30
+ Spaceship::ConnectAPI::Device.create(name: name, platform: platform, udid: udid)
22
31
  rescue => ex
23
32
  UI.error(ex.to_s)
24
- UI.crash!("Failed to register new device (name: #{name}, UDID: #{udid})")
33
+ UI.crash!("Failed to register new device (name: #{name}, platform: #{platform}, UDID: #{udid})")
25
34
  end
26
35
 
27
36
  UI.success("Successfully registered new device")
28
37
  return udid
29
38
  end
30
39
 
40
+ def self.api_token(params)
41
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
42
+ api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
43
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
44
+ return api_token
45
+ end
46
+
31
47
  def self.description
32
48
  "Registers a new device to the Apple Dev Portal"
33
49
  end
@@ -35,14 +51,38 @@ module Fastlane
35
51
  def self.available_options
36
52
  user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id)
37
53
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
54
+ platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_s
38
55
 
39
56
  [
40
57
  FastlaneCore::ConfigItem.new(key: :name,
41
58
  env_name: "FL_REGISTER_DEVICE_NAME",
42
59
  description: "Provide the name of the device to register as"),
60
+ FastlaneCore::ConfigItem.new(key: :platform,
61
+ env_name: "FL_REGISTER_DEVICE_PLATFORM",
62
+ description: "Provide the platform of the device to register as (ios, mac)",
63
+ optional: true,
64
+ default_value: platform.empty? ? "ios" : platform,
65
+ verify_block: proc do |value|
66
+ UI.user_error!("The platform can only be ios or mac") unless %('ios', 'mac').include?(value)
67
+ end),
43
68
  FastlaneCore::ConfigItem.new(key: :udid,
44
69
  env_name: "FL_REGISTER_DEVICE_UDID",
45
70
  description: "Provide the UDID of the device to register as"),
71
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
72
+ env_name: "FL_REGISTER_DEVICE_API_KEY_PATH",
73
+ description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
74
+ optional: true,
75
+ conflicting_options: [:api_key],
76
+ verify_block: proc do |value|
77
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
78
+ end),
79
+ FastlaneCore::ConfigItem.new(key: :api_key,
80
+ env_name: "FL_REGISTER_DEVICE_API_KEY",
81
+ description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)",
82
+ type: Hash,
83
+ optional: true,
84
+ sensitive: true,
85
+ conflicting_options: [:api_key_path]),
46
86
  FastlaneCore::ConfigItem.new(key: :team_id,
47
87
  env_name: "REGISTER_DEVICE_TEAM_ID",
48
88
  code_gen_sensitive: true,
@@ -66,6 +106,7 @@ module Fastlane
66
106
  FastlaneCore::ConfigItem.new(key: :username,
67
107
  env_name: "DELIVER_USER",
68
108
  description: "Optional: Your Apple ID",
109
+ optional: true,
69
110
  default_value: user,
70
111
  default_value_dynamic: true)
71
112
  ]
@@ -12,6 +12,8 @@ module Fastlane
12
12
  end
13
13
 
14
14
  def self.run(params)
15
+ platform = Spaceship::ConnectAPI::BundleIdPlatform.map(params[:platform])
16
+
15
17
  if params[:devices]
16
18
  new_devices = params[:devices].map do |name, udid|
17
19
  [udid, name]
@@ -37,40 +39,57 @@ module Fastlane
37
39
  end
38
40
 
39
41
  require 'spaceship'
40
- credentials = CredentialsManager::AccountManager.new(user: params[:username])
41
- Spaceship.login(credentials.user, credentials.password)
42
- Spaceship.select_team
43
-
44
- UI.message("Fetching list of currently registered devices...")
45
- all_platforms = Set[params[:platform]]
46
- new_devices.each do |device|
47
- next if device[2].nil?
48
- all_platforms.add(device[2])
42
+ if (token = api_token(params))
43
+ UI.message("Using App Store Connect API token...")
44
+ Spaceship::ConnectAPI.token = token
45
+ else
46
+ UI.message("Login to App Store Connect (#{params[:username]})")
47
+ credentials = CredentialsManager::AccountManager.new(user: params[:username])
48
+ Spaceship::ConnectAPI.login(credentials.user, credentials.password, use_portal: true, use_tunes: false)
49
+ UI.message("Login successful")
49
50
  end
50
- supported_platforms = all_platforms.select { |platform| self.is_supported?(platform.to_sym) }
51
51
 
52
- existing_devices = supported_platforms.flat_map { |platform| Spaceship::Device.all(mac: platform == "mac") }
52
+ UI.message("Fetching list of currently registered devices...")
53
+ existing_devices = Spaceship::ConnectAPI::Device.all
53
54
 
54
55
  device_objs = new_devices.map do |device|
55
- next if existing_devices.map(&:udid).include?(device[0])
56
+ if existing_devices.map(&:udid).map(&:downcase).include?(device[0].downcase)
57
+ UI.verbose("UDID #{device[0]} already exists - Skipping...")
58
+ next
59
+ end
60
+
61
+ device_platform = platform
56
62
 
57
63
  device_platform_supported = !device[2].nil? && self.is_supported?(device[2].to_sym)
58
- mac = (device_platform_supported ? device[2] : params[:platform]) == "mac"
64
+ if device_platform_supported
65
+ if device[2] == "mac"
66
+ device_platform = Spaceship::ConnectAPI::BundleIdPlatform::MAC_OS
67
+ else
68
+ device_platform = Spaceship::ConnectAPI::BundleIdPlatform::IOS
69
+ end
70
+ end
59
71
 
60
- try_create_device(name: device[1], udid: device[0], mac: mac)
72
+ try_create_device(name: device[1], platform: device_platform, udid: device[0])
61
73
  end
62
74
 
63
75
  UI.success("Successfully registered new devices.")
64
76
  return device_objs
65
77
  end
66
78
 
67
- def self.try_create_device(name: nil, udid: nil, mac: false)
68
- Spaceship::Device.create!(name: name, udid: udid, mac: mac)
79
+ def self.try_create_device(name: nil, platform: nil, udid: nil)
80
+ Spaceship::ConnectAPI::Device.create(name: name, platform: platform, udid: udid)
69
81
  rescue => ex
70
82
  UI.error(ex.to_s)
71
83
  UI.crash!("Failed to register new device (name: #{name}, UDID: #{udid})")
72
84
  end
73
85
 
86
+ def self.api_token(params)
87
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
88
+ api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
89
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
90
+ return api_token
91
+ end
92
+
74
93
  #####################################################
75
94
  # @!group Documentation
76
95
  #####################################################
@@ -98,6 +117,21 @@ module Fastlane
98
117
  verify_block: proc do |value|
99
118
  UI.user_error!("Could not find file '#{value}'") unless File.exist?(value)
100
119
  end),
120
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
121
+ env_name: "FL_REGISTER_DEVICES_API_KEY_PATH",
122
+ description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
123
+ optional: true,
124
+ conflicting_options: [:api_key],
125
+ verify_block: proc do |value|
126
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
127
+ end),
128
+ FastlaneCore::ConfigItem.new(key: :api_key,
129
+ env_name: "FL_REGISTER_DEVICES_API_KEY",
130
+ description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)",
131
+ type: Hash,
132
+ optional: true,
133
+ sensitive: true,
134
+ conflicting_options: [:api_key_path]),
101
135
  FastlaneCore::ConfigItem.new(key: :team_id,
102
136
  env_name: "REGISTER_DEVICES_TEAM_ID",
103
137
  code_gen_sensitive: true,
@@ -6,9 +6,14 @@ module Fastlane
6
6
 
7
7
  # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
8
8
  # Prompts select team if multiple teams and none specified
9
- UI.message("Login to App Store Connect (#{params[:username]})")
10
- Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true)
11
- UI.message("Login successful")
9
+ if (token = self.api_token(params))
10
+ UI.message("Using App Store Connect API token...")
11
+ Spaceship::ConnectAPI.token = token
12
+ else
13
+ UI.message("Login to App Store Connect (#{params[:username]})")
14
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
15
+ UI.message("Login successful")
16
+ end
12
17
 
13
18
  app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
14
19
  UI.user_error!("Couldn't find app with identifier #{params[:app_identifier]}") if app.nil?
@@ -73,6 +78,13 @@ module Fastlane
73
78
  UI.success("👼 Successfully pushed the new changelog to for #{edit_version.version_string}")
74
79
  end
75
80
 
81
+ def self.api_token(params)
82
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
83
+ api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
84
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
85
+ return api_token
86
+ end
87
+
76
88
  def self.default_changelog_path
77
89
  File.join(FastlaneCore::FastlaneFolder.path.to_s, 'changelog.txt')
78
90
  end
@@ -98,6 +110,21 @@ module Fastlane
98
110
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
99
111
 
100
112
  [
113
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
114
+ env_name: "FL_SET_CHANGELOG_API_KEY_PATH",
115
+ description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
116
+ optional: true,
117
+ conflicting_options: [:api_key],
118
+ verify_block: proc do |value|
119
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
120
+ end),
121
+ FastlaneCore::ConfigItem.new(key: :api_key,
122
+ env_name: "FL_SET_CHANGELOG_API_KEY",
123
+ description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)",
124
+ type: Hash,
125
+ optional: true,
126
+ sensitive: true,
127
+ conflicting_options: [:api_key_path]),
101
128
  FastlaneCore::ConfigItem.new(key: :app_identifier,
102
129
  short_option: "-a",
103
130
  env_name: "FASTLANE_APP_IDENTIFIER",
@@ -109,6 +136,7 @@ module Fastlane
109
136
  short_option: "-u",
110
137
  env_name: "FASTLANE_USERNAME",
111
138
  description: "Your Apple ID Username",
139
+ optional: true,
112
140
  default_value: user,
113
141
  default_value_dynamic: true),
114
142
  FastlaneCore::ConfigItem.new(key: :version,
@@ -10,6 +10,7 @@ module Fastlane
10
10
  require 'match'
11
11
 
12
12
  params.load_configuration_file("Matchfile")
13
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
13
14
  Match::Runner.new.run(params)
14
15
 
15
16
  define_profile_type(params)
@@ -45,25 +45,31 @@ module Fastlane
45
45
  end
46
46
 
47
47
  # suppress updater output - very noisy
48
- Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
48
+ Gem::DefaultUserInteraction.ui = Gem::SilentUI.new unless FastlaneCore::Globals.verbose?
49
49
 
50
50
  update_needed.each do |tool_info|
51
- tool = tool_info[0]
51
+ tool = self.get_gem_name(tool_info)
52
52
  local_version = Gem::Version.new(highest_versions[tool].version)
53
53
  latest_official_version = FastlaneCore::UpdateChecker.fetch_latest(tool)
54
54
 
55
55
  UI.message("Updating #{tool} from #{local_version.to_s.yellow} to #{latest_official_version.to_s.yellow}... 🚀")
56
56
 
57
- # Approximate_recommendation will create a string like "~> 0.10" from a version 0.10.0, e.g. one that is valid for versions >= 0.10 and <1.0
58
- requirement_version = local_version.approximate_recommendation
59
- updater.update_gem(tool, Gem::Requirement.new(requirement_version))
57
+ if Helper.homebrew?
58
+ Helper.backticks('brew upgrade fastlane')
59
+ else
60
+ # Approximate_recommendation will create a string like "~> 0.10" from a version 0.10.0, e.g. one that is valid for versions >= 0.10 and <1.0
61
+ requirement_version = local_version.approximate_recommendation
62
+ updater.update_gem(tool, Gem::Requirement.new(requirement_version))
63
+ end
60
64
 
61
65
  UI.success("Finished updating #{tool}")
62
66
  end
63
67
 
64
- UI.message("Cleaning up old versions...")
65
- cleaner.options[:args] = tools_to_update
66
- cleaner.execute
68
+ unless Helper.homebrew?
69
+ UI.message("Cleaning up old versions...")
70
+ cleaner.options[:args] = tools_to_update
71
+ cleaner.execute
72
+ end
67
73
 
68
74
  UI.message("fastlane.tools successfully updated! I will now restart myself... 😴")
69
75
 
@@ -71,6 +77,16 @@ module Fastlane
71
77
  exec("FL_NO_UPDATE=true #{$PROGRAM_NAME} #{ARGV.join(' ')}")
72
78
  end
73
79
 
80
+ def self.get_gem_name(tool_info)
81
+ if tool_info.kind_of?(Array)
82
+ return tool_info[0]
83
+ elsif tool_info.respond_to?(:name) # Gem::NameTuple in RubyGems >= 3.1.0
84
+ return tool_info.name
85
+ else
86
+ UI.crash!("Unknown gem update information returned from RubyGems. Please file a new issue for this... 🤷")
87
+ end
88
+ end
89
+
74
90
  def self.description
75
91
  "Makes sure fastlane-tools are up-to-date when running fastlane"
76
92
  end
@@ -12,6 +12,7 @@ module Fastlane
12
12
  config[:screenshots_path] = Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH] if Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH]
13
13
  config[:ipa] = Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] if Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
14
14
  config[:pkg] = Actions.lane_context[SharedValues::PKG_OUTPUT_PATH] if Actions.lane_context[SharedValues::PKG_OUTPUT_PATH]
15
+ config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
15
16
 
16
17
  return config if Helper.test?
17
18
  Deliver::Runner.new(config).run
@@ -26,7 +27,7 @@ module Fastlane
26
27
  [
27
28
  "Using _upload_to_app_store_ after _build_app_ and _capture_screenshots_ will automatically upload the latest ipa and screenshots with no other configuration.",
28
29
  "",
29
- "If you don't want a PDF report for App Store builds, use the `:force` option.",
30
+ "If you don't want to verify an HTML preview for App Store builds, use the `:force` option.",
30
31
  "This is useful when running _fastlane_ on your Continuous Integration server:",
31
32
  "`_upload_to_app_store_(force: true)`",
32
33
  "If your account is on multiple teams and you need to tell the `iTMSTransporter` which 'provider' to use, you can set the `:itc_provider` option to pass this info."
@@ -50,7 +51,7 @@ module Fastlane
50
51
  def self.example_code
51
52
  [
52
53
  'upload_to_app_store(
53
- force: true, # Set to true to skip PDF verification
54
+ force: true, # Set to true to skip verification of HTML preview
54
55
  itc_provider: "abcde12345" # pass a specific value to the iTMSTransporter -itc_provider option
55
56
  )',
56
57
  'deliver # alias for "upload_to_app_store"',