fastlane 2.183.2 → 2.184.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +88 -88
  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 +19 -5
  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/app_store_build_number.rb +7 -11
  17. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +12 -2
  18. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +5 -1
  19. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +32 -12
  20. data/fastlane/lib/fastlane/actions/get_certificates.rb +5 -1
  21. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +5 -1
  22. data/fastlane/lib/fastlane/actions/register_device.rb +7 -10
  23. data/fastlane/lib/fastlane/actions/register_devices.rb +7 -10
  24. data/fastlane/lib/fastlane/actions/set_changelog.rb +7 -10
  25. data/fastlane/lib/fastlane/actions/swiftlint.rb +16 -4
  26. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +6 -1
  27. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +5 -1
  28. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +2 -1
  29. data/fastlane/lib/fastlane/swift_fastlane_function.rb +6 -4
  30. data/fastlane/lib/fastlane/version.rb +1 -1
  31. data/fastlane/swift/Deliverfile.swift +1 -1
  32. data/fastlane/swift/DeliverfileProtocol.swift +20 -20
  33. data/fastlane/swift/Fastlane.swift +462 -240
  34. data/fastlane/swift/Gymfile.swift +1 -1
  35. data/fastlane/swift/GymfileProtocol.swift +1 -1
  36. data/fastlane/swift/Matchfile.swift +1 -1
  37. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  38. data/fastlane/swift/OptionalConfigValue.swift +2 -32
  39. data/fastlane/swift/Precheckfile.swift +1 -1
  40. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  41. data/fastlane/swift/Scanfile.swift +1 -1
  42. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  43. data/fastlane/swift/Screengrabfile.swift +1 -1
  44. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  45. data/fastlane/swift/Snapshotfile.swift +1 -1
  46. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  47. data/fastlane/swift/formatting/Brewfile.lock.json +2 -2
  48. data/fastlane_core/lib/fastlane_core/build_watcher.rb +24 -1
  49. data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +5 -0
  50. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +2 -0
  51. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +1 -1
  52. data/match/lib/match/importer.rb +6 -10
  53. data/match/lib/match/migrate.rb +2 -3
  54. data/match/lib/match/nuke.rb +3 -7
  55. data/match/lib/match/runner.rb +2 -3
  56. data/match/lib/match/spaceship_ensure.rb +3 -0
  57. data/match/lib/match/storage/google_cloud_storage.rb +2 -2
  58. data/match/lib/match/storage/s3_storage.rb +2 -2
  59. data/pilot/lib/pilot/build_manager.rb +2 -0
  60. data/pilot/lib/pilot/manager.rb +3 -7
  61. data/pilot/lib/pilot/options.rb +8 -0
  62. data/precheck/lib/precheck/runner.rb +8 -7
  63. data/sigh/lib/assets/resign.sh +77 -46
  64. data/sigh/lib/sigh/download_all.rb +4 -8
  65. data/sigh/lib/sigh/runner.rb +4 -8
  66. data/spaceship/lib/spaceship/connect_api/models/.age_rating_declaration.rb.swp +0 -0
  67. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +35 -4
  68. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +10 -0
  69. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +2 -3
  70. data/spaceship/lib/spaceship/connect_api/token.rb +6 -0
  71. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +4 -2
  72. metadata +19 -18
@@ -26,9 +26,11 @@ module Deliver
26
26
  end
27
27
 
28
28
  def login
29
- if api_token
29
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: options[:api_key], filepath: options[:api_key_path]))
30
30
  UI.message("Creating authorization token for App Store Connect API")
31
31
  Spaceship::ConnectAPI.token = api_token
32
+ elsif !Spaceship::ConnectAPI.token.nil?
33
+ UI.message("Using existing authorization token for App Store Connect API")
32
34
  else
33
35
  # Username is now optional since addition of App Store Connect API Key
34
36
  # Force asking for username to prompt user if not already set
@@ -42,12 +44,6 @@ module Deliver
42
44
  end
43
45
  end
44
46
 
45
- def api_token
46
- @api_token ||= Spaceship::ConnectAPI::Token.create(**options[:api_key]) if options[:api_key]
47
- @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(options[:api_key_path]) if options[:api_key_path]
48
- return @api_token
49
- end
50
-
51
47
  def run
52
48
  verify_version if options[:app_version].to_s.length > 0 && !options[:skip_app_version_update]
53
49
 
@@ -118,7 +114,7 @@ module Deliver
118
114
  app_version = options[:app_version]
119
115
  UI.message("Making sure the latest version on App Store Connect matches '#{app_version}'...")
120
116
 
121
- app = options[:app]
117
+ app = Deliver.cache[:app]
122
118
 
123
119
  platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
124
120
  changed = app.ensure_version!(app_version, platform: platform)
@@ -167,14 +163,14 @@ module Deliver
167
163
 
168
164
  if upload_ipa
169
165
  package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(
170
- app_id: options[:app].id,
166
+ app_id: Deliver.cache[:app].id,
171
167
  ipa_path: options[:ipa],
172
168
  package_path: "/tmp",
173
169
  platform: options[:platform]
174
170
  )
175
171
  elsif upload_pkg
176
172
  package_path = FastlaneCore::PkgUploadPackageBuilder.new.generate(
177
- app_id: options[:app].id,
173
+ app_id: Deliver.cache[:app].id,
178
174
  pkg_path: options[:pkg],
179
175
  package_path: "/tmp",
180
176
  platform: options[:platform]
@@ -191,7 +187,7 @@ module Deliver
191
187
  end
192
188
 
193
189
  def reject_version_if_possible
194
- app = options[:app]
190
+ app = Deliver.cache[:app]
195
191
  platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
196
192
  if app.reject_version_if_possible!(platform: platform)
197
193
  UI.success("Successfully rejected previous version!")
@@ -210,6 +206,7 @@ module Deliver
210
206
  # If there are fewer than two teams, don't infer the provider.
211
207
  def transporter_for_selected_team
212
208
  # Use JWT auth
209
+ api_token = Spaceship::ConnectAPI.token
213
210
  unless api_token.nil?
214
211
  api_token.refresh! if api_token.expired?
215
212
  return FastlaneCore::ItunesTransporter.new(nil, nil, false, nil, api_token.text)
@@ -39,7 +39,7 @@ module Deliver
39
39
  # This method takes care of creating a new 'deliver' folder, containing the app metadata
40
40
  # and screenshots folders
41
41
  def generate_deliver_file(deliver_path, options)
42
- app = options[:app]
42
+ app = Deliver.cache[:app]
43
43
 
44
44
  platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
45
45
  v = app.get_latest_app_store_version(platform: platform)
@@ -7,7 +7,7 @@ require 'fastlane_core/pkg_file_analyser'
7
7
  module Deliver
8
8
  class SubmitForReview
9
9
  def submit!(options)
10
- app = options[:app]
10
+ app = Deliver.cache[:app]
11
11
 
12
12
  platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
13
13
  version = app.get_edit_app_store_version(platform: platform)
@@ -82,7 +82,7 @@ module Deliver
82
82
  def upload(options)
83
83
  return if options[:skip_metadata]
84
84
 
85
- app = options[:app]
85
+ app = Deliver.cache[:app]
86
86
 
87
87
  platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
88
88
 
@@ -342,7 +342,7 @@ module Deliver
342
342
 
343
343
  set_review_information(version, options)
344
344
  set_review_attachment_file(version, options)
345
- set_app_rating(version, options)
345
+ set_app_rating(app_info, options)
346
346
  end
347
347
 
348
348
  # rubocop:enable Metrics/PerceivedComplexity
@@ -642,7 +642,7 @@ module Deliver
642
642
  end
643
643
  end
644
644
 
645
- def set_app_rating(version, options)
645
+ def set_app_rating(app_info, options)
646
646
  return unless options[:app_rating_config_path]
647
647
 
648
648
  require 'json'
@@ -675,9 +675,23 @@ module Deliver
675
675
  has_mapped_values = true
676
676
  UI.deprecated("Age rating '#{k}' from iTunesConnect has been deprecated. Please replace with '#{v}'")
677
677
  end
678
- UI.deprecated("You can find more info at https://docs.fastlane.tools/actions/deliver/#reference") if has_mapped_values
679
678
 
680
- age_rating_declaration = version.fetch_age_rating_declaration
679
+ # Handle App Store Connect deprecation/migrations of keys/values if possible
680
+ attributes, deprecation_messages, errors = Spaceship::ConnectAPI::AgeRatingDeclaration.map_deprecation_if_possible(attributes)
681
+ deprecation_messages.each do |message|
682
+ UI.deprecated(message)
683
+ end
684
+
685
+ unless errors.empty?
686
+ errors.each do |error|
687
+ UI.error(error)
688
+ end
689
+ UI.user_error!("There are Age Rating deprecation errors that cannot be solved automatically... Please apply any fixes and try again")
690
+ end
691
+
692
+ UI.deprecated("You can find more info at https://docs.fastlane.tools/actions/deliver/#reference") if has_mapped_values || !deprecation_messages.empty?
693
+
694
+ age_rating_declaration = app_info.fetch_age_rating_declaration
681
695
  age_rating_declaration.update(attributes: attributes)
682
696
  end
683
697
  end
@@ -9,7 +9,7 @@ module Deliver
9
9
 
10
10
  price_tier = options[:price_tier].to_s
11
11
 
12
- app = options[:app]
12
+ app = Deliver.cache[:app]
13
13
 
14
14
  attributes = {}
15
15
  territory_ids = []
@@ -17,7 +17,7 @@ module Deliver
17
17
  return if options[:skip_screenshots]
18
18
  return if options[:edit_live]
19
19
 
20
- app = options[:app]
20
+ app = Deliver.cache[:app]
21
21
 
22
22
  platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
23
23
  version = app.get_edit_app_store_version(platform: platform)
@@ -27,10 +27,11 @@ module Fastlane
27
27
 
28
28
  def self.get_build_number(params)
29
29
  # Prompts select team if multiple teams and none specified
30
- token = self.api_token(params)
31
- if token
32
- UI.message("Using App Store Connect API token...")
33
- Spaceship::ConnectAPI.token = token
30
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path]))
31
+ UI.message("Creating authorization token for App Store Connect API")
32
+ Spaceship::ConnectAPI.token = api_token
33
+ elsif !Spaceship::ConnectAPI.token.nil?
34
+ UI.message("Using existing authorization token for App Store Connect API")
34
35
  else
35
36
  # Username is now optional since addition of App Store Connect API Key
36
37
  # Force asking for username to prompt user if not already set
@@ -102,13 +103,6 @@ module Fastlane
102
103
  versions.map(&:to_s).sort_by { |v| Gem::Version.new(v) }
103
104
  end
104
105
 
105
- def self.api_token(params)
106
- params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
107
- api_token ||= Spaceship::ConnectAPI::Token.create(**params[:api_key]) if params[:api_key]
108
- api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
109
- return api_token
110
- end
111
-
112
106
  #####################################################
113
107
  # @!group Documentation
114
108
  #####################################################
@@ -133,6 +127,8 @@ module Fastlane
133
127
  env_names: ["APPSTORE_BUILD_NUMBER_API_KEY", "APP_STORE_CONNECT_API_KEY"],
134
128
  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)",
135
129
  type: Hash,
130
+ default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY],
131
+ default_value_dynamic: true,
136
132
  optional: true,
137
133
  sensitive: true,
138
134
  conflicting_options: [:api_key_path]),
@@ -1,4 +1,5 @@
1
1
  require 'base64'
2
+ require 'spaceship'
2
3
 
3
4
  module Fastlane
4
5
  module Actions
@@ -37,6 +38,10 @@ module Fastlane
37
38
 
38
39
  Actions.lane_context.set_sensitive(SharedValues::APP_STORE_CONNECT_API_KEY, key)
39
40
 
41
+ # Creates Spaceship API Key session
42
+ # User does not need to pass the token into any actions because of this
43
+ Spaceship::ConnectAPI.token = Spaceship::ConnectAPI::Token.create(key) if options[:set_spaceship_token]
44
+
40
45
  return key
41
46
  end
42
47
 
@@ -83,8 +88,13 @@ module Fastlane
83
88
  FastlaneCore::ConfigItem.new(key: :in_house,
84
89
  env_name: "APP_STORE_CONNECT_API_KEY_IN_HOUSE",
85
90
  description: "Is App Store or Enterprise (in house) team? App Store Connect API cannot determine this on its own (yet)",
86
- optional: true,
87
- type: Boolean)
91
+ type: Boolean,
92
+ default_value: false),
93
+ FastlaneCore::ConfigItem.new(key: :set_spaceship_token,
94
+ env_name: "APP_STORE_CONNECT_API_KEY_SET_SPACESHIP_TOKEN",
95
+ description: "Authorizes all Spaceship::ConnectAPI requests by automatically setting Spaceship::ConnectAPI.token",
96
+ type: Boolean,
97
+ default_value: true)
88
98
  ]
89
99
  end
90
100
 
@@ -5,9 +5,13 @@ module Fastlane
5
5
 
6
6
  class CheckAppStoreMetadataAction < Action
7
7
  def self.run(config)
8
+ # Only set :api_key from SharedValues if :api_key_path isn't set (conflicting options)
9
+ unless config[:api_key_path]
10
+ config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
11
+ end
12
+
8
13
  require 'precheck'
9
14
  Precheck.config = config
10
- Precheck.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
11
15
  return Precheck::Runner.new.run
12
16
  end
13
17
 
@@ -601,24 +601,44 @@ Key | Editable While Live | Directory | Filename | Deprecated Filename
601
601
 
602
602
  **Keys**
603
603
 
604
- - `violenceCartoonOrFantasy`
605
- - `violenceRealistic`
606
- - `violenceRealisticProlongedGraphicOrSadistic`
607
- - `profanityOrCrudeHumor`
608
- - `matureOrSuggestiveThemes`
609
- - `horrorOrFearThemes`
610
- - `medicalOrTreatmentInformation`
611
- - `alcoholTobaccoOrDrugUseOrReferences`
612
- - `gamblingSimulated`
613
- - `sexualContentOrNudity`
614
- - `sexualContentGraphicAndNudity`
604
+ - 'alcoholTobaccoOrDrugUseOrReferences'
605
+ - 'contests'
606
+ - 'gambling'
607
+ - 'gamblingSimulated'
608
+ - 'medicalOrTreatmentInformation'
609
+ - 'profanityOrCrudeHumor'
610
+
611
+ - 'sexualContentGraphicAndNudity'
612
+ - 'sexualContentOrNudity'
613
+ - 'horrorOrFearThemes'
614
+ - 'matureOrSuggestiveThemes'
615
+ - 'unrestrictedWebAccess'
616
+ - 'violenceCartoonOrFantasy'
617
+ - 'violenceRealisticProlongedGraphicOrSadistic'
618
+ - 'violenceRealistic'
619
+ - 'kidsAgeBand'
615
620
 
616
621
  #### Boolean
617
622
 
618
623
  **Keys**
619
624
 
625
+ - `gambling`
626
+ - 'seventeenPlus'
620
627
  - `unrestrictedWebAccess`
621
- - `gamblingAndContests`
628
+
629
+ #### Kids Age
630
+
631
+ **Values**
632
+
633
+ - `FIVE_AND_UNDER`
634
+ - `SIX_TO_EIGHT`
635
+ - `NINE_TO_ELEVEN`
636
+ - `null`
637
+
638
+ **Keys**
639
+
640
+ - `kidsAgeBand`
641
+
622
642
  </details>
623
643
 
624
644
  <br />
@@ -12,8 +12,12 @@ module Fastlane
12
12
  return if Helper.test?
13
13
 
14
14
  begin
15
+ # Only set :api_key from SharedValues if :api_key_path isn't set (conflicting options)
16
+ unless params[:api_key_path]
17
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
18
+ end
19
+
15
20
  Cert.config = params # we alread have the finished config
16
- Cert.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
17
21
 
18
22
  Cert::Runner.new.launch
19
23
  cert_file_path = ENV["CER_FILE_PATH"]
@@ -14,8 +14,12 @@ module Fastlane
14
14
  require 'sigh'
15
15
  require 'credentials_manager/appfile_config'
16
16
 
17
+ # Only set :api_key from SharedValues if :api_key_path isn't set (conflicting options)
18
+ unless values[:api_key_path]
19
+ values[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
20
+ end
21
+
17
22
  Sigh.config = values # we already have the finished config
18
- Sigh.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
19
23
 
20
24
  path = Sigh::Manager.start
21
25
 
@@ -16,9 +16,11 @@ module Fastlane
16
16
 
17
17
  platform = Spaceship::ConnectAPI::BundleIdPlatform.map(platform)
18
18
 
19
- if (token = api_token(params))
20
- UI.message("Using App Store Connect API token...")
21
- Spaceship::ConnectAPI.token = token
19
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path]))
20
+ UI.message("Creating authorization token for App Store Connect API")
21
+ Spaceship::ConnectAPI.token = api_token
22
+ elsif !Spaceship::ConnectAPI.token.nil?
23
+ UI.message("Using existing authorization token for App Store Connect API")
22
24
  else
23
25
  UI.message("Login to App Store Connect (#{params[:username]})")
24
26
  credentials = CredentialsManager::AccountManager.new(user: params[:username])
@@ -37,13 +39,6 @@ module Fastlane
37
39
  return udid
38
40
  end
39
41
 
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
-
47
42
  def self.description
48
43
  "Registers a new device to the Apple Dev Portal"
49
44
  end
@@ -80,6 +75,8 @@ module Fastlane
80
75
  env_names: ["FL_REGISTER_DEVICE_API_KEY", "APP_STORE_CONNECT_API_KEY"],
81
76
  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
77
  type: Hash,
78
+ default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY],
79
+ default_value_dynamic: true,
83
80
  optional: true,
84
81
  sensitive: true,
85
82
  conflicting_options: [:api_key_path]),
@@ -39,9 +39,11 @@ module Fastlane
39
39
  end
40
40
 
41
41
  require 'spaceship'
42
- if (token = api_token(params))
43
- UI.message("Using App Store Connect API token...")
44
- Spaceship::ConnectAPI.token = token
42
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path]))
43
+ UI.message("Creating authorization token for App Store Connect API")
44
+ Spaceship::ConnectAPI.token = api_token
45
+ elsif !Spaceship::ConnectAPI.token.nil?
46
+ UI.message("Using existing authorization token for App Store Connect API")
45
47
  else
46
48
  UI.message("Login to App Store Connect (#{params[:username]})")
47
49
  credentials = CredentialsManager::AccountManager.new(user: params[:username])
@@ -83,13 +85,6 @@ module Fastlane
83
85
  UI.crash!("Failed to register new device (name: #{name}, UDID: #{udid})")
84
86
  end
85
87
 
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
-
93
88
  #####################################################
94
89
  # @!group Documentation
95
90
  #####################################################
@@ -129,6 +124,8 @@ module Fastlane
129
124
  env_names: ["FL_REGISTER_DEVICES_API_KEY", "APP_STORE_CONNECT_API_KEY"],
130
125
  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
126
  type: Hash,
127
+ default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY],
128
+ default_value_dynamic: true,
132
129
  optional: true,
133
130
  sensitive: true,
134
131
  conflicting_options: [:api_key_path]),
@@ -6,9 +6,11 @@ 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
- if (token = self.api_token(params))
10
- UI.message("Using App Store Connect API token...")
11
- Spaceship::ConnectAPI.token = token
9
+ if (api_token = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path]))
10
+ UI.message("Creating authorization token for App Store Connect API")
11
+ Spaceship::ConnectAPI.token = api_token
12
+ elsif !Spaceship::ConnectAPI.token.nil?
13
+ UI.message("Using existing authorization token for App Store Connect API")
12
14
  else
13
15
  UI.message("Login to App Store Connect (#{params[:username]})")
14
16
  Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
@@ -78,13 +80,6 @@ module Fastlane
78
80
  UI.success("👼 Successfully pushed the new changelog to for #{edit_version.version_string}")
79
81
  end
80
82
 
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
-
88
83
  def self.default_changelog_path
89
84
  File.join(FastlaneCore::FastlaneFolder.path.to_s, 'changelog.txt')
90
85
  end
@@ -122,6 +117,8 @@ module Fastlane
122
117
  env_names: ["FL_SET_CHANGELOG_API_KEY", "APP_STORE_CONNECT_API_KEY"],
123
118
  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
119
  type: Hash,
120
+ default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::APP_STORE_CONNECT_API_KEY],
121
+ default_value_dynamic: true,
125
122
  optional: true,
126
123
  sensitive: true,
127
124
  conflicting_options: [:api_key_path]),