fastlane 2.157.2 → 2.160.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -80
  3. data/deliver/lib/deliver/options.rb +17 -1
  4. data/deliver/lib/deliver/runner.rb +36 -6
  5. data/deliver/lib/deliver/upload_metadata.rb +36 -6
  6. data/deliver/lib/deliver/upload_price_tier.rb +7 -2
  7. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +12 -8
  8. data/fastlane/lib/fastlane/actions/clean_build_artifacts.rb +1 -0
  9. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -0
  10. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +1 -1
  11. data/fastlane/lib/fastlane/actions/download_dsyms.rb +116 -71
  12. data/fastlane/lib/fastlane/actions/set_changelog.rb +2 -1
  13. data/fastlane/lib/fastlane/helper/git_helper.rb +2 -0
  14. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +6 -4
  15. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  16. data/fastlane/lib/fastlane/version.rb +1 -1
  17. data/fastlane/swift/Actions.swift +2 -1
  18. data/fastlane/swift/Appfile.swift +2 -4
  19. data/fastlane/swift/ArgumentProcessor.swift +2 -6
  20. data/fastlane/swift/ControlCommand.swift +2 -5
  21. data/fastlane/swift/Deliverfile.swift +5 -2
  22. data/fastlane/swift/DeliverfileProtocol.swift +15 -4
  23. data/fastlane/swift/Fastfile.swift +5 -1
  24. data/fastlane/swift/Fastlane.swift +2279 -2237
  25. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +5 -5
  26. data/fastlane/swift/Gymfile.swift +5 -2
  27. data/fastlane/swift/GymfileProtocol.swift +6 -3
  28. data/fastlane/swift/LaneFileProtocol.swift +36 -19
  29. data/fastlane/swift/MainProcess.swift +77 -0
  30. data/fastlane/swift/Matchfile.swift +5 -2
  31. data/fastlane/swift/MatchfileProtocol.swift +6 -3
  32. data/fastlane/swift/Plugins.swift +2 -1
  33. data/fastlane/swift/Precheckfile.swift +5 -2
  34. data/fastlane/swift/PrecheckfileProtocol.swift +18 -3
  35. data/fastlane/swift/RubyCommand.swift +2 -6
  36. data/fastlane/swift/RubyCommandable.swift +2 -6
  37. data/fastlane/swift/Runner.swift +5 -9
  38. data/fastlane/swift/RunnerArgument.swift +2 -6
  39. data/fastlane/swift/Scanfile.swift +5 -2
  40. data/fastlane/swift/ScanfileProtocol.swift +6 -3
  41. data/fastlane/swift/Screengrabfile.swift +5 -2
  42. data/fastlane/swift/ScreengrabfileProtocol.swift +6 -3
  43. data/fastlane/swift/Snapshotfile.swift +5 -2
  44. data/fastlane/swift/SnapshotfileProtocol.swift +6 -3
  45. data/fastlane/swift/SocketClient.swift +3 -7
  46. data/fastlane/swift/SocketClientDelegateProtocol.swift +2 -6
  47. data/fastlane/swift/SocketResponse.swift +2 -6
  48. data/fastlane/swift/formatting/Brewfile.lock.json +18 -10
  49. data/fastlane/swift/main.swift +4 -8
  50. data/fastlane/swift/upgrade_manifest.json +1 -1
  51. data/frameit/lib/frameit/editor.rb +1 -0
  52. data/match/lib/match/importer.rb +5 -2
  53. data/match/lib/match/spaceship_ensure.rb +5 -5
  54. data/pilot/lib/pilot/build_manager.rb +0 -3
  55. data/pilot/lib/pilot/manager.rb +1 -2
  56. data/pilot/lib/pilot/options.rb +2 -2
  57. data/precheck/lib/precheck/options.rb +25 -0
  58. data/precheck/lib/precheck/rule_processor.rb +94 -60
  59. data/precheck/lib/precheck/runner.rb +26 -5
  60. data/produce/lib/produce/itunes_connect.rb +2 -1
  61. data/sigh/lib/assets/resign.sh +9 -6
  62. data/sigh/lib/sigh/runner.rb +2 -1
  63. data/snapshot/lib/assets/SnapshotHelper.swift +17 -2
  64. data/spaceship/lib/spaceship/client.rb +1 -0
  65. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  66. data/spaceship/lib/spaceship/connect_api/client.rb +34 -7
  67. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +2 -0
  68. data/spaceship/lib/spaceship/connect_api/models/.app_store_version_submission.rb.swp +0 -0
  69. data/spaceship/lib/spaceship/connect_api/models/app.rb +22 -14
  70. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  71. data/spaceship/lib/spaceship/connect_api/models/app_price_point.rb +26 -0
  72. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +2 -2
  73. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +10 -6
  74. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +3 -5
  75. data/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb +21 -0
  76. data/spaceship/lib/spaceship/connect_api/spaceship.rb +3 -2
  77. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +50 -50
  78. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +31 -6
  79. metadata +21 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 465b4bc1e3551c467e870d317ff7a226dd9f5ecac4c6c27dc23505d2d2e53ee7
4
- data.tar.gz: 2cdde87ff47e244e29d6970da46e72bca189224686fe92f19f6203a731b77030
3
+ metadata.gz: 1397a58b9e5db2690af6f035c6b0599471135fca731aa8ca32d9332e92aa0f4d
4
+ data.tar.gz: 28074ccdc0e5948e4d2882d45207229fae454f5712d8a3448e7306bba339a81f
5
5
  SHA512:
6
- metadata.gz: f1bc24ba94758c5195c6485c270cf2e143f4ecc1eebec467be9f4e3c5aae625020ac58f380888f67553fa1c13f5d921e0328bc3e0b2c0b15a28d3a6253563cf4
7
- data.tar.gz: 12398261e87004b0877024398f825f4533af281bf5685de0a1a111fdc91588abc02aa5eb23011777b1c78c0aca31939652d8d8bc18bbeb93b0aacc3a8fce8a49
6
+ metadata.gz: 0cd4759b7d14605eba44cc49c2ba83989b4b2435ecc0b02d9ce7a162c10c67202504eec4ea4e4cd255f866b929419ee6f670828e6992b34a4845789a870daaea
7
+ data.tar.gz: 9c1e740b44e8022f87ef2009caaad53bc2ea4c6eb00abe80477c8945bac056e0b6de7c88d90a8e1b85a4ad27ce62fd417b1529e4e1c97c52d321a0f269192cba
data/README.md CHANGED
@@ -34,75 +34,17 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
34
34
  <!-- This table is regenerated and resorted on each release -->
35
35
  <table id='team'>
36
36
  <tr>
37
- <td id='olivier-halligon'>
38
- <a href='https://github.com/AliSoftware'>
39
- <img src='https://github.com/AliSoftware.png?size=140'>
40
- </a>
41
- <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
42
- </td>
43
- <td id='aaron-brager'>
44
- <a href='https://github.com/getaaron'>
45
- <img src='https://github.com/getaaron.png?size=140'>
46
- </a>
47
- <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
48
- </td>
49
- <td id='josh-holtz'>
50
- <a href='https://github.com/joshdholtz'>
51
- <img src='https://github.com/joshdholtz.png?size=140'>
52
- </a>
53
- <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
54
- </td>
55
- <td id='joshua-liebowitz'>
56
- <a href='https://github.com/taquitos'>
57
- <img src='https://github.com/taquitos.png?size=140'>
58
- </a>
59
- <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
60
- </td>
61
- <td id='jérôme-lacoste'>
62
- <a href='https://github.com/lacostej'>
63
- <img src='https://github.com/lacostej.png?size=140'>
64
- </a>
65
- <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
66
- </td>
67
- </tr>
68
- <tr>
69
37
  <td id='fumiya-nakamura'>
70
38
  <a href='https://github.com/nafu'>
71
39
  <img src='https://github.com/nafu.png?size=140'>
72
40
  </a>
73
41
  <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
74
42
  </td>
75
- <td id='matthew-ellis'>
76
- <a href='https://github.com/matthewellis'>
77
- <img src='https://github.com/matthewellis.png?size=140'>
78
- </a>
79
- <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
80
- </td>
81
- <td id='danielle-tomlinson'>
82
- <a href='https://github.com/endocrimes'>
83
- <img src='https://github.com/endocrimes.png?size=140'>
84
- </a>
85
- <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
86
- </td>
87
- <td id='jorge-revuelta-h'>
88
- <a href='https://github.com/minuscorp'>
89
- <img src='https://github.com/minuscorp.png?size=140'>
90
- </a>
91
- <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
92
- </td>
93
- <td id='helmut-januschka'>
94
- <a href='https://github.com/hjanuschka'>
95
- <img src='https://github.com/hjanuschka.png?size=140'>
96
- </a>
97
- <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
98
- </td>
99
- </tr>
100
- <tr>
101
- <td id='felix-krause'>
102
- <a href='https://github.com/KrauseFx'>
103
- <img src='https://github.com/KrauseFx.png?size=140'>
43
+ <td id='stefan-natchev'>
44
+ <a href='https://github.com/snatchev'>
45
+ <img src='https://github.com/snatchev.png?size=140'>
104
46
  </a>
105
- <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
47
+ <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
106
48
  </td>
107
49
  <td id='andrew-mcburney'>
108
50
  <a href='https://github.com/armcburney'>
@@ -110,26 +52,64 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
110
52
  </a>
111
53
  <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
112
54
  </td>
55
+ <td id='aaron-brager'>
56
+ <a href='https://github.com/getaaron'>
57
+ <img src='https://github.com/getaaron.png?size=140'>
58
+ </a>
59
+ <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
60
+ </td>
113
61
  <td id='jimmy-dee'>
114
62
  <a href='https://github.com/jdee'>
115
63
  <img src='https://github.com/jdee.png?size=140'>
116
64
  </a>
117
65
  <h4 align='center'>Jimmy Dee</h4>
118
66
  </td>
67
+ </tr>
68
+ <tr>
119
69
  <td id='maksym-grebenets'>
120
70
  <a href='https://github.com/mgrebenets'>
121
71
  <img src='https://github.com/mgrebenets.png?size=140'>
122
72
  </a>
123
73
  <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
124
74
  </td>
75
+ <td id='felix-krause'>
76
+ <a href='https://github.com/KrauseFx'>
77
+ <img src='https://github.com/KrauseFx.png?size=140'>
78
+ </a>
79
+ <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
80
+ </td>
125
81
  <td id='max-ott'>
126
82
  <a href='https://github.com/max-ott'>
127
83
  <img src='https://github.com/max-ott.png?size=140'>
128
84
  </a>
129
85
  <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
130
86
  </td>
87
+ <td id='jorge-revuelta-h'>
88
+ <a href='https://github.com/minuscorp'>
89
+ <img src='https://github.com/minuscorp.png?size=140'>
90
+ </a>
91
+ <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
92
+ </td>
93
+ <td id='kohki-miki'>
94
+ <a href='https://github.com/giginet'>
95
+ <img src='https://github.com/giginet.png?size=140'>
96
+ </a>
97
+ <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
98
+ </td>
131
99
  </tr>
132
100
  <tr>
101
+ <td id='joshua-liebowitz'>
102
+ <a href='https://github.com/taquitos'>
103
+ <img src='https://github.com/taquitos.png?size=140'>
104
+ </a>
105
+ <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
106
+ </td>
107
+ <td id='olivier-halligon'>
108
+ <a href='https://github.com/AliSoftware'>
109
+ <img src='https://github.com/AliSoftware.png?size=140'>
110
+ </a>
111
+ <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
112
+ </td>
133
113
  <td id='daniel-jankowski'>
134
114
  <a href='https://github.com/mollyIV'>
135
115
  <img src='https://github.com/mollyIV.png?size=140'>
@@ -142,11 +122,37 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
142
122
  </a>
143
123
  <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
144
124
  </td>
145
- <td id='manu-wallner'>
146
- <a href='https://github.com/milch'>
147
- <img src='https://github.com/milch.png?size=140'>
125
+ <td id='luka-mirosevic'>
126
+ <a href='https://github.com/lmirosevic'>
127
+ <img src='https://github.com/lmirosevic.png?size=140'>
148
128
  </a>
149
- <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
129
+ <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
130
+ </td>
131
+ </tr>
132
+ <tr>
133
+ <td id='josh-holtz'>
134
+ <a href='https://github.com/joshdholtz'>
135
+ <img src='https://github.com/joshdholtz.png?size=140'>
136
+ </a>
137
+ <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
138
+ </td>
139
+ <td id='helmut-januschka'>
140
+ <a href='https://github.com/hjanuschka'>
141
+ <img src='https://github.com/hjanuschka.png?size=140'>
142
+ </a>
143
+ <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
144
+ </td>
145
+ <td id='matthew-ellis'>
146
+ <a href='https://github.com/matthewellis'>
147
+ <img src='https://github.com/matthewellis.png?size=140'>
148
+ </a>
149
+ <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
150
+ </td>
151
+ <td id='danielle-tomlinson'>
152
+ <a href='https://github.com/endocrimes'>
153
+ <img src='https://github.com/endocrimes.png?size=140'>
154
+ </a>
155
+ <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
150
156
  </td>
151
157
  <td id='iulian-onofrei'>
152
158
  <a href='https://github.com/revolter'>
@@ -154,25 +160,19 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
154
160
  </a>
155
161
  <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
156
162
  </td>
157
- <td id='kohki-miki'>
158
- <a href='https://github.com/giginet'>
159
- <img src='https://github.com/giginet.png?size=140'>
160
- </a>
161
- <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
162
- </td>
163
163
  </tr>
164
164
  <tr>
165
- <td id='luka-mirosevic'>
166
- <a href='https://github.com/lmirosevic'>
167
- <img src='https://github.com/lmirosevic.png?size=140'>
165
+ <td id='manu-wallner'>
166
+ <a href='https://github.com/milch'>
167
+ <img src='https://github.com/milch.png?size=140'>
168
168
  </a>
169
- <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
169
+ <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
170
170
  </td>
171
- <td id='stefan-natchev'>
172
- <a href='https://github.com/snatchev'>
173
- <img src='https://github.com/snatchev.png?size=140'>
171
+ <td id='jérôme-lacoste'>
172
+ <a href='https://github.com/lacostej'>
173
+ <img src='https://github.com/lacostej.png?size=140'>
174
174
  </a>
175
- <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
175
+ <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
176
176
  </td>
177
177
  </table>
178
178
 
@@ -12,6 +12,22 @@ module Deliver
12
12
  user ||= ENV["DELIVER_USER"]
13
13
 
14
14
  [
15
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
16
+ env_name: "DELIVER_API_KEY_PATH",
17
+ 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)",
18
+ optional: true,
19
+ conflicting_options: [:username],
20
+ verify_block: proc do |value|
21
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
22
+ end),
23
+ FastlaneCore::ConfigItem.new(key: :api_key,
24
+ env_name: "DELIVER_API_KEY",
25
+ 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)",
26
+ type: Hash,
27
+ optional: true,
28
+ sensitive: true,
29
+ conflicting_options: [:api_key_path, :username]),
30
+
15
31
  FastlaneCore::ConfigItem.new(key: :username,
16
32
  short_option: "-u",
17
33
  env_name: "DELIVER_USERNAME",
@@ -129,7 +145,7 @@ module Deliver
129
145
  default_value: false),
130
146
  FastlaneCore::ConfigItem.new(key: :skip_app_version_update,
131
147
  env_name: "DELIVER_SKIP_APP_VERSION_UPDATE",
132
- description: "Don't update app version for submission",
148
+ description: "Dont create or update the app version that is being prepared for submission",
133
149
  is_string: false,
134
150
  default_value: false),
135
151
 
@@ -26,10 +26,22 @@ module Deliver
26
26
  end
27
27
 
28
28
  def login
29
- UI.message("Login to App Store Connect (#{options[:username]})")
30
- Spaceship::ConnectAPI.login(options[:username], nil, use_portal: false, use_tunes: true)
31
- Spaceship::ConnectAPI.select_team
32
- UI.message("Login successful")
29
+ if api_token
30
+ UI.message("Creating authorization token for App Store Connect API")
31
+ Spaceship::ConnectAPI.token = api_token
32
+ else
33
+ # Team selection passed though FASTLANE_TEAM_ID and FASTLANE_TEAM_NAME environment variables
34
+ # Prompts select team if multiple teams and none specified
35
+ UI.message("Login to App Store Connect (#{options[:username]})")
36
+ Spaceship::ConnectAPI.login(options[:username], nil, use_portal: false, use_tunes: true)
37
+ UI.message("Login successful")
38
+ end
39
+ end
40
+
41
+ def api_token
42
+ @api_token ||= Spaceship::ConnectAPI::Token.create(options[:api_key]) if options[:api_key]
43
+ @api_token ||= Spaceship::ConnectAPI::Token.from_json_file(options[:api_key_path]) if options[:api_key_path]
44
+ return @api_token
33
45
  end
34
46
 
35
47
  def run
@@ -66,10 +78,21 @@ module Deliver
66
78
  precheck_options = {
67
79
  default_rule_level: options[:precheck_default_rule_level],
68
80
  include_in_app_purchases: options[:precheck_include_in_app_purchases],
69
- app_identifier: options[:app_identifier],
70
- username: options[:username]
81
+ app_identifier: options[:app_identifier]
71
82
  }
72
83
 
84
+ if options[:api_key] || options[:api_key_path]
85
+ if options[:precheck_include_in_app_purchases]
86
+ UI.user_error!("Precheck cannot check In-app purchases with the App Store Connect API Key (yet). Exclude In-app purchases from precheck or use Apple ID login")
87
+ end
88
+
89
+ precheck_options[:api_key] = options[:api_key]
90
+ precheck_options[:api_key_path] = options[:api_key_path]
91
+ else
92
+ precheck_options[:username] = options[:username]
93
+ precheck_options[:platform] = options[:platform]
94
+ end
95
+
73
96
  precheck_config = FastlaneCore::Configuration.create(Precheck::Options.available_options, precheck_options)
74
97
  Precheck.config = precheck_config
75
98
 
@@ -173,10 +196,17 @@ module Deliver
173
196
 
174
197
  private
175
198
 
199
+ # If App Store Connect API token, use token.
176
200
  # If itc_provider was explicitly specified, use it.
177
201
  # If there are multiple teams, infer the provider from the selected team name.
178
202
  # If there are fewer than two teams, don't infer the provider.
179
203
  def transporter_for_selected_team
204
+ # Use JWT auth
205
+ unless api_token.nil?
206
+ api_token.refresh! if api_token.expired?
207
+ return FastlaneCore::ItunesTransporter.new(nil, nil, false, nil, api_token.text)
208
+ end
209
+
180
210
  tunes_client = Spaceship::ConnectAPI.client.tunes_client
181
211
 
182
212
  generic_transporter = FastlaneCore::ItunesTransporter.new(options[:username], nil, false, options[:itc_provider])
@@ -96,7 +96,7 @@ module Deliver
96
96
 
97
97
  if v.nil?
98
98
  UI.message("Couldn't find live version, editing the current version on App Store Connect instead")
99
- version = app.get_edit_app_store_version(platform: platform)
99
+ version = fetch_edit_app_store_version(app, platform)
100
100
  # we don't want to update the localised_options and non_localised_options
101
101
  # as we also check for `options[:edit_live]` at other areas in the code
102
102
  # by not touching those 2 variables, deliver is more consistent with what the option says
@@ -105,13 +105,17 @@ module Deliver
105
105
  UI.message("Found live version")
106
106
  end
107
107
  else
108
- version = app.get_edit_app_store_version(platform: platform)
108
+ version = fetch_edit_app_store_version(app, platform)
109
109
  localised_options = (LOCALISED_VERSION_VALUES.keys + LOCALISED_APP_VALUES.keys)
110
110
  non_localised_options = NON_LOCALISED_VERSION_VALUES.keys
111
111
  end
112
112
 
113
113
  # Needed for to filter out release notes from being sent up
114
- number_of_versions = app.get_app_store_versions(filter: { platform: platform }, limit: 2).size
114
+ number_of_versions = Spaceship::ConnectAPI.get_app_store_versions(
115
+ app_id: app.id,
116
+ filter: { platform: platform },
117
+ limit: 2
118
+ ).count
115
119
  is_first_version = number_of_versions == 1
116
120
  UI.verbose("Version '#{version.version_string}' is the first version on App Store Connect") if is_first_version
117
121
 
@@ -202,7 +206,7 @@ module Deliver
202
206
  end
203
207
 
204
208
  # Update categories
205
- app_info = app.fetch_edit_app_info
209
+ app_info = fetch_edit_app_info(app)
206
210
  if app_info
207
211
  category_id_map = {}
208
212
 
@@ -410,9 +414,35 @@ module Deliver
410
414
  .uniq
411
415
  end
412
416
 
417
+ def fetch_edit_app_store_version(app, platform, wait_time: 10)
418
+ retry_if_nil("Cannot find edit app store version", wait_time: wait_time) do
419
+ app.get_edit_app_store_version(platform: platform)
420
+ end
421
+ end
422
+
423
+ def fetch_edit_app_info(app, wait_time: 10)
424
+ retry_if_nil("Cannot find edit app info", wait_time: wait_time) do
425
+ app.fetch_edit_app_info
426
+ end
427
+ end
428
+
429
+ def retry_if_nil(message, tries: 5, wait_time: 10)
430
+ loop do
431
+ tries -= 1
432
+
433
+ value = yield
434
+ return value if value
435
+
436
+ UI.message("#{message}... Retrying after #{wait_time} seconds (remaining: #{tries})")
437
+ sleep(wait_time)
438
+
439
+ return nil if tries.zero?
440
+ end
441
+ end
442
+
413
443
  # Finding languages to enable
414
444
  def verify_available_info_languages!(options, app, languages)
415
- app_info = app.fetch_edit_app_info
445
+ app_info = fetch_edit_app_info(app)
416
446
 
417
447
  unless app_info
418
448
  UI.user_error!("Cannot update languages - could not find an editable info")
@@ -447,7 +477,7 @@ module Deliver
447
477
  # Finding languages to enable
448
478
  def verify_available_version_languages!(options, app, languages)
449
479
  platform = Spaceship::ConnectAPI::Platform.map(options[:platform])
450
- version = app.get_edit_app_store_version(platform: platform)
480
+ version = fetch_edit_app_store_version(app, platform)
451
481
 
452
482
  unless version
453
483
  UI.user_error!("Cannot update languages - could not find an editable version for '#{platform}'")
@@ -14,9 +14,14 @@ module Deliver
14
14
  attributes = {}
15
15
  territory_ids = []
16
16
 
17
- app_prices = app.fetch_app_prices
17
+ # As of 2020-09-14:
18
+ # Official App Store Connect does not have an endpoint to get app prices for an app
19
+ # Need to get prices from the app's relationships
20
+ # Prices from app's relationship doess not have price tier so need to fetch app price with price tier relationship
21
+ app_prices = app.prices
18
22
  if app_prices.first
19
- old_price = app_prices.first.price_tier.id
23
+ app_price = Spaceship::ConnectAPI.get_app_price(app_price_id: app_prices.first.id, includes: "priceTier").first
24
+ old_price = app_price.price_tier.id
20
25
  else
21
26
  UI.message("App has no prices yet... Enabling all countries in App Store Connect")
22
27
  territory_ids = Spaceship::ConnectAPI::Territory.all.map(&:id)
@@ -26,27 +26,31 @@ module Fastlane
26
26
  end
27
27
 
28
28
  def self.get_build_number(params)
29
+ # Prompts select team if multiple teams and none specified
29
30
  UI.message("Login to App Store Connect (#{params[:username]})")
30
- Spaceship::Tunes.login(params[:username])
31
- Spaceship::Tunes.select_team(team_id: params[:team_id], team_name: params[:team_name])
31
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
32
32
  UI.message("Login successful")
33
33
 
34
- app = Spaceship::Tunes::Application.find(params[:app_identifier], mac: params[:platform] == "osx")
34
+ platform = Spaceship::ConnectAPI::Platform.map(params[:platform])
35
+
36
+ app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
35
37
  UI.user_error!("Could not find an app on App Store Connect with app_identifier: #{params[:app_identifier]}") unless app
36
38
  if params[:live]
37
39
  UI.message("Fetching the latest build number for live-version")
38
- UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on iTC") unless app.live_version
39
- build_nr = app.live_version.current_build_number
40
+ live_version = app.get_live_app_store_version(platform: platform)
41
+
42
+ UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on App Store Connect") unless live_version
43
+ build_nr = live_version.build.version
40
44
 
41
- UI.message("Latest upload for live-version #{app.live_version.version} is build: #{build_nr}")
45
+ UI.message("Latest upload for live-version #{live_version.version_string} is build: #{build_nr}")
42
46
 
43
- return OpenStruct.new({ build_nr: build_nr, build_v: app.live_version.version })
47
+ return OpenStruct.new({ build_nr: build_nr, build_v: live_version.version_string })
44
48
  else
45
49
  version_number = params[:version]
46
50
  platform = params[:platform]
47
51
 
48
52
  # Create filter for get_builds with optional version number
49
- filter = { app: app.apple_id }
53
+ filter = { app: app.id }
50
54
  if version_number
51
55
  filter["preReleaseVersion.version"] = version_number
52
56
  version_number_message = "version #{version_number}"