fastlane 2.162.0 → 2.163.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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -72
  3. data/deliver/lib/deliver/module.rb +2 -0
  4. data/deliver/lib/deliver/options.rb +3 -3
  5. data/deliver/lib/deliver/upload_metadata.rb +12 -3
  6. data/fastlane/lib/fastlane/actions/.register_device.rb.swp +0 -0
  7. data/fastlane/lib/fastlane/actions/.register_devices.rb.swp +0 -0
  8. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +39 -3
  9. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +9 -0
  10. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +1 -0
  11. data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -0
  12. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -0
  13. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +15 -0
  14. data/fastlane/lib/fastlane/actions/register_device.rb +46 -5
  15. data/fastlane/lib/fastlane/actions/register_devices.rb +46 -15
  16. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +1 -0
  17. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -2
  18. data/fastlane/lib/fastlane/version.rb +1 -1
  19. data/fastlane/swift/Deliverfile.swift +1 -1
  20. data/fastlane/swift/DeliverfileProtocol.swift +4 -4
  21. data/fastlane/swift/Fastlane.swift +46 -16
  22. data/fastlane/swift/Gymfile.swift +1 -1
  23. data/fastlane/swift/GymfileProtocol.swift +1 -1
  24. data/fastlane/swift/LaneFileProtocol.swift +15 -19
  25. data/fastlane/swift/MainProcess.swift +1 -1
  26. data/fastlane/swift/Matchfile.swift +1 -1
  27. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  28. data/fastlane/swift/Precheckfile.swift +1 -1
  29. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  30. data/fastlane/swift/Scanfile.swift +1 -1
  31. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  32. data/fastlane/swift/Screengrabfile.swift +1 -1
  33. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  34. data/fastlane/swift/Snapshotfile.swift +1 -1
  35. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  36. data/fastlane/swift/main.swift +1 -1
  37. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  38. data/sigh/lib/sigh/download_all.rb +16 -4
  39. data/snapshot/lib/assets/SnapshotHelper.swift +4 -0
  40. data/spaceship/lib/spaceship/client.rb +7 -3
  41. data/spaceship/lib/spaceship/connect_api.rb +24 -0
  42. data/spaceship/lib/spaceship/connect_api/api_client.rb +9 -0
  43. data/spaceship/lib/spaceship/connect_api/models/device.rb +5 -0
  44. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +17 -0
  45. data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
  46. metadata +17 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfbc3b8babe2db6398b23a113db895f79eea46daa635909a2146e2df6ab4fa2d
4
- data.tar.gz: d643dd677d37e514523433380eb65dc67798ec67cb9c4726c33e84529156b337
3
+ metadata.gz: 9018a049a27d02426f74370e23deb841ec641e4f446e6d334a7ae122223c1812
4
+ data.tar.gz: 9c8f3652d0af272b012df00af5b191e78bcadc8da89aab7e8e4578bd40e5af31
5
5
  SHA512:
6
- metadata.gz: c50b7bb1afb78e3c2e8577d11092879dfb0c748a131ba3cf164a05e1f41df81d1472a951f1b609eaced0162c85045221ff08813ae69d0ae713ef325e2aa11a46
7
- data.tar.gz: 873270ee657aa2d0fe1f13153d2bf2c26e1ed5fbebb6815ca363f783f3550bbb30abad62922b115402a38231681af72211feaac937611e1773448a493f54003c
6
+ metadata.gz: 10e7d05e7d169ca32bd90cb75e137c7acd9d04fdefc575d0e72bbe923e76e5ce121b6c528d82ea4acf78d0914d025e90fb7d01935cb147c4db60bc8dcb59dc00
7
+ data.tar.gz: b2fa4c281f7f73fb6132588b6027a95c50f349e57c8c1093295b2f0757e5e0352fae18f59f5fb9070dc4927a2d87b99e2307fda64748b27ffbcf93901d99c810
data/README.md CHANGED
@@ -34,38 +34,24 @@ 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='matthew-ellis'>
38
- <a href='https://github.com/matthewellis'>
39
- <img src='https://github.com/matthewellis.png?size=140'>
40
- </a>
41
- <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
42
- </td>
43
37
  <td id='andrew-mcburney'>
44
38
  <a href='https://github.com/armcburney'>
45
39
  <img src='https://github.com/armcburney.png?size=140'>
46
40
  </a>
47
41
  <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
48
42
  </td>
49
- <td id='fumiya-nakamura'>
50
- <a href='https://github.com/nafu'>
51
- <img src='https://github.com/nafu.png?size=140'>
52
- </a>
53
- <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
54
- </td>
55
- <td id='stefan-natchev'>
56
- <a href='https://github.com/snatchev'>
57
- <img src='https://github.com/snatchev.png?size=140'>
58
- </a>
59
- <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
60
- </td>
61
43
  <td id='felix-krause'>
62
44
  <a href='https://github.com/KrauseFx'>
63
45
  <img src='https://github.com/KrauseFx.png?size=140'>
64
46
  </a>
65
47
  <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
66
48
  </td>
67
- </tr>
68
- <tr>
49
+ <td id='luka-mirosevic'>
50
+ <a href='https://github.com/lmirosevic'>
51
+ <img src='https://github.com/lmirosevic.png?size=140'>
52
+ </a>
53
+ <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
54
+ </td>
69
55
  <td id='iulian-onofrei'>
70
56
  <a href='https://github.com/revolter'>
71
57
  <img src='https://github.com/revolter.png?size=140'>
@@ -78,69 +64,31 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
78
64
  </a>
79
65
  <h4 align='center'>Jimmy Dee</h4>
80
66
  </td>
67
+ </tr>
68
+ <tr>
81
69
  <td id='jan-piotrowski'>
82
70
  <a href='https://github.com/janpio'>
83
71
  <img src='https://github.com/janpio.png?size=140'>
84
72
  </a>
85
73
  <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
86
74
  </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='jérôme-lacoste'>
94
- <a href='https://github.com/lacostej'>
95
- <img src='https://github.com/lacostej.png?size=140'>
96
- </a>
97
- <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
98
- </td>
99
- </tr>
100
- <tr>
101
- <td id='daniel-jankowski'>
102
- <a href='https://github.com/mollyIV'>
103
- <img src='https://github.com/mollyIV.png?size=140'>
104
- </a>
105
- <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
106
- </td>
107
75
  <td id='joshua-liebowitz'>
108
76
  <a href='https://github.com/taquitos'>
109
77
  <img src='https://github.com/taquitos.png?size=140'>
110
78
  </a>
111
79
  <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
112
80
  </td>
113
- <td id='danielle-tomlinson'>
114
- <a href='https://github.com/endocrimes'>
115
- <img src='https://github.com/endocrimes.png?size=140'>
116
- </a>
117
- <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
118
- </td>
119
81
  <td id='max-ott'>
120
82
  <a href='https://github.com/max-ott'>
121
83
  <img src='https://github.com/max-ott.png?size=140'>
122
84
  </a>
123
85
  <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
124
86
  </td>
125
- <td id='luka-mirosevic'>
126
- <a href='https://github.com/lmirosevic'>
127
- <img src='https://github.com/lmirosevic.png?size=140'>
128
- </a>
129
- <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
130
- </td>
131
- </tr>
132
- <tr>
133
- <td id='helmut-januschka'>
134
- <a href='https://github.com/hjanuschka'>
135
- <img src='https://github.com/hjanuschka.png?size=140'>
136
- </a>
137
- <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
138
- </td>
139
- <td id='olivier-halligon'>
140
- <a href='https://github.com/AliSoftware'>
141
- <img src='https://github.com/AliSoftware.png?size=140'>
87
+ <td id='manu-wallner'>
88
+ <a href='https://github.com/milch'>
89
+ <img src='https://github.com/milch.png?size=140'>
142
90
  </a>
143
- <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
91
+ <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
144
92
  </td>
145
93
  <td id='josh-holtz'>
146
94
  <a href='https://github.com/joshdholtz'>
@@ -148,31 +96,83 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
148
96
  </a>
149
97
  <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
150
98
  </td>
99
+ </tr>
100
+ <tr>
101
+ <td id='jorge-revuelta-h'>
102
+ <a href='https://github.com/minuscorp'>
103
+ <img src='https://github.com/minuscorp.png?size=140'>
104
+ </a>
105
+ <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
106
+ </td>
151
107
  <td id='aaron-brager'>
152
108
  <a href='https://github.com/getaaron'>
153
109
  <img src='https://github.com/getaaron.png?size=140'>
154
110
  </a>
155
111
  <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
156
112
  </td>
113
+ <td id='stefan-natchev'>
114
+ <a href='https://github.com/snatchev'>
115
+ <img src='https://github.com/snatchev.png?size=140'>
116
+ </a>
117
+ <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
118
+ </td>
119
+ <td id='maksym-grebenets'>
120
+ <a href='https://github.com/mgrebenets'>
121
+ <img src='https://github.com/mgrebenets.png?size=140'>
122
+ </a>
123
+ <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
124
+ </td>
125
+ <td id='jérôme-lacoste'>
126
+ <a href='https://github.com/lacostej'>
127
+ <img src='https://github.com/lacostej.png?size=140'>
128
+ </a>
129
+ <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
130
+ </td>
131
+ </tr>
132
+ <tr>
133
+ <td id='helmut-januschka'>
134
+ <a href='https://github.com/hjanuschka'>
135
+ <img src='https://github.com/hjanuschka.png?size=140'>
136
+ </a>
137
+ <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
138
+ </td>
139
+ <td id='matthew-ellis'>
140
+ <a href='https://github.com/matthewellis'>
141
+ <img src='https://github.com/matthewellis.png?size=140'>
142
+ </a>
143
+ <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
144
+ </td>
157
145
  <td id='kohki-miki'>
158
146
  <a href='https://github.com/giginet'>
159
147
  <img src='https://github.com/giginet.png?size=140'>
160
148
  </a>
161
149
  <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
162
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>
156
+ </td>
157
+ <td id='olivier-halligon'>
158
+ <a href='https://github.com/AliSoftware'>
159
+ <img src='https://github.com/AliSoftware.png?size=140'>
160
+ </a>
161
+ <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
162
+ </td>
163
163
  </tr>
164
164
  <tr>
165
- <td id='manu-wallner'>
166
- <a href='https://github.com/milch'>
167
- <img src='https://github.com/milch.png?size=140'>
165
+ <td id='fumiya-nakamura'>
166
+ <a href='https://github.com/nafu'>
167
+ <img src='https://github.com/nafu.png?size=140'>
168
168
  </a>
169
- <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
169
+ <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
170
170
  </td>
171
- <td id='maksym-grebenets'>
172
- <a href='https://github.com/mgrebenets'>
173
- <img src='https://github.com/mgrebenets.png?size=140'>
171
+ <td id='daniel-jankowski'>
172
+ <a href='https://github.com/mollyIV'>
173
+ <img src='https://github.com/mollyIV.png?size=140'>
174
174
  </a>
175
- <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
175
+ <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
176
176
  </td>
177
177
  </table>
178
178
 
@@ -1,5 +1,6 @@
1
1
  require 'fastlane_core/helper'
2
2
  require 'fastlane_core/ui/ui'
3
+ require 'fastlane/boolean'
3
4
 
4
5
  module Deliver
5
6
  class << self
@@ -7,6 +8,7 @@ module Deliver
7
8
 
8
9
  Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
9
10
  UI = FastlaneCore::UI
11
+ Boolean = Fastlane::Boolean
10
12
 
11
13
  # Constant that captures the root Pathname for the project. Should be used for building paths to assets or other
12
14
  # resources that code needs to locate locally
@@ -153,7 +153,7 @@ module Deliver
153
153
  FastlaneCore::ConfigItem.new(key: :force,
154
154
  short_option: "-f",
155
155
  env_name: "DELIVER_FORCE",
156
- description: "Skip the HTML report file verification",
156
+ description: "Skip verification of HTML preview file",
157
157
  is_string: false,
158
158
  default_value: false),
159
159
  FastlaneCore::ConfigItem.new(key: :overwrite_screenshots,
@@ -176,8 +176,8 @@ module Deliver
176
176
  FastlaneCore::ConfigItem.new(key: :automatic_release,
177
177
  env_name: "DELIVER_AUTOMATIC_RELEASE",
178
178
  description: "Should the app be automatically released once it's approved? (Can not be used together with `auto_release_date`)",
179
- is_string: false,
180
- default_value: false),
179
+ type: Boolean,
180
+ optional: true),
181
181
  FastlaneCore::ConfigItem.new(key: :auto_release_date,
182
182
  env_name: "DELIVER_AUTO_RELEASE_DATE",
183
183
  description: "Date in milliseconds for automatically releasing on pending approval (Can not be used together with `automatic_release`)",
@@ -175,17 +175,26 @@ module Deliver
175
175
 
176
176
  non_localized_version_attributes['earliestReleaseDate'] = date
177
177
  Spaceship::ConnectAPI::AppStoreVersion::ReleaseType::SCHEDULED
178
- elsif options[:automatic_release]
178
+ elsif options[:automatic_release] == true
179
179
  Spaceship::ConnectAPI::AppStoreVersion::ReleaseType::AFTER_APPROVAL
180
- else
180
+ elsif options[:automatic_release] == false
181
181
  Spaceship::ConnectAPI::AppStoreVersion::ReleaseType::MANUAL
182
182
  end
183
- non_localized_version_attributes['releaseType'] = release_type
183
+ if release_type.nil?
184
+ UI.important("Release type will not be set because neither `automatic_release` nor `auto_release_date` were provided. Please explicitly set one of these options if you need a release type set")
185
+ else
186
+ non_localized_version_attributes['releaseType'] = release_type
187
+ end
184
188
 
185
189
  # Update app store version
186
190
  # This needs to happen before updating localizations (https://openradar.appspot.com/radar?id=4925914991296512)
191
+ #
192
+ # Adding some sleeps because the API will sometimes be in a state where releaseType can't be modified
193
+ # https://github.com/fastlane/fastlane/issues/16911
187
194
  UI.message("Uploading metadata to App Store Connect for version")
195
+ sleep(2)
188
196
  version.update(attributes: non_localized_version_attributes)
197
+ sleep(1)
189
198
 
190
199
  # Update app store version localizations
191
200
  app_store_version_localizations.each do |app_store_version_localization|
@@ -27,9 +27,15 @@ module Fastlane
27
27
 
28
28
  def self.get_build_number(params)
29
29
  # Prompts select team if multiple teams and none specified
30
- UI.message("Login to App Store Connect (#{params[:username]})")
31
- Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
32
- UI.message("Login successful")
30
+ token = self.api_token(params)
31
+ if token
32
+ UI.message("Using App Store Connect API token...")
33
+ Spaceship::ConnectAPI.token = token
34
+ else
35
+ UI.message("Login to App Store Connect (#{params[:username]})")
36
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
37
+ UI.message("Login successful")
38
+ end
33
39
 
34
40
  platform = Spaceship::ConnectAPI::Platform.map(params[:platform])
35
41
 
@@ -92,6 +98,13 @@ module Fastlane
92
98
  versions.map(&:to_s).sort_by { |v| Gem::Version.new(v) }
93
99
  end
94
100
 
101
+ def self.api_token(params)
102
+ params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
103
+ api_token ||= Spaceship::ConnectAPI::Token.create(params[:api_key]) if params[:api_key]
104
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(params[:api_key_path]) if params[:api_key_path]
105
+ return api_token
106
+ end
107
+
95
108
  #####################################################
96
109
  # @!group Documentation
97
110
  #####################################################
@@ -104,6 +117,21 @@ module Fastlane
104
117
  user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id)
105
118
  user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
106
119
  [
120
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
121
+ env_name: "APPSTORE_BUILD_NUMBER_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: "APPSTORE_BUILD_NUMBER_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]),
107
135
  FastlaneCore::ConfigItem.new(key: :initial_build_number,
108
136
  env_name: "INITIAL_BUILD_NUMBER",
109
137
  description: "sets the build number to given value if no build is in current train",
@@ -193,6 +221,14 @@ module Fastlane
193
221
  live: false,
194
222
  app_identifier: "app.identifier",
195
223
  version: "1.2.9"
224
+ )',
225
+ 'api_key = app_store_connect_api_key(
226
+ key_id: "MyKeyID12345",
227
+ issuer_id: "00000000-0000-0000-0000-000000000000",
228
+ key_filepath: "./AuthKey.p8"
229
+ )
230
+ build_num = app_store_build_number(
231
+ api_key: api_key
196
232
  )'
197
233
  ]
198
234
  end
@@ -1,3 +1,5 @@
1
+ require 'base64'
2
+
1
3
  module Fastlane
2
4
  module Actions
3
5
  module SharedValues
@@ -9,6 +11,7 @@ module Fastlane
9
11
  key_id = options[:key_id]
10
12
  issuer_id = options[:issuer_id]
11
13
  key_content = options[:key_content]
14
+ is_key_content_base64 = options[:is_key_content_base64]
12
15
  key_filepath = options[:key_filepath]
13
16
  duration = options[:duration]
14
17
  in_house = options[:in_house]
@@ -27,6 +30,7 @@ module Fastlane
27
30
  key_id: key_id,
28
31
  issuer_id: issuer_id,
29
32
  key: key_content || File.binread(key_filepath),
33
+ is_key_content_base64: is_key_content_base64,
30
34
  duration: duration,
31
35
  in_house: in_house
32
36
  }
@@ -62,6 +66,11 @@ module Fastlane
62
66
  sensitive: true,
63
67
  optional: true,
64
68
  conflicting_options: [:filepath]),
69
+ FastlaneCore::ConfigItem.new(key: :is_key_content_base64,
70
+ env_name: "APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64",
71
+ description: "Whether :key_content is Base64 encoded or not",
72
+ type: Boolean,
73
+ default_value: false),
65
74
  FastlaneCore::ConfigItem.new(key: :duration,
66
75
  env_name: "APP_STORE_CONNECT_API_KEY_DURATION",
67
76
  description: "The token session duration",
@@ -7,6 +7,7 @@ module Fastlane
7
7
  def self.run(config)
8
8
  require 'precheck'
9
9
  Precheck.config = config
10
+ Precheck.config[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
10
11
  return Precheck::Runner.new.run
11
12
  end
12
13
 
@@ -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
 
@@ -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
  ]