fastlane 2.162.0 → 2.163.0

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
@@ -28,7 +28,7 @@ class MainProcess {
28
28
  @objc func connectToFastlaneAndRunLane(_ fastfile: LaneFile?) {
29
29
  runner.startSocketThread(port: argumentProcessor.port)
30
30
 
31
- let completedRun = Fastfile.runLane(from: fastfile, named: argumentProcessor.currentLane, parameters: argumentProcessor.laneParameters())
31
+ let completedRun = Fastfile.runLane(from: fastfile, named: argumentProcessor.currentLane, with: argumentProcessor.laneParameters())
32
32
  if completedRun {
33
33
  runner.disconnectFromFastlaneProcess()
34
34
  }
@@ -17,4 +17,4 @@ public class Matchfile: MatchfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.162.0
20
+ // Generated with fastlane 2.163.0
@@ -180,4 +180,4 @@ public extension MatchfileProtocol {
180
180
 
181
181
  // Please don't remove the lines below
182
182
  // They are used to detect outdated files
183
- // FastlaneRunnerAPIVersion [0.9.42]
183
+ // FastlaneRunnerAPIVersion [0.9.43]
@@ -17,4 +17,4 @@ public class Precheckfile: PrecheckfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.162.0
20
+ // Generated with fastlane 2.163.0
@@ -48,4 +48,4 @@ public extension PrecheckfileProtocol {
48
48
 
49
49
  // Please don't remove the lines below
50
50
  // They are used to detect outdated files
51
- // FastlaneRunnerAPIVersion [0.9.41]
51
+ // FastlaneRunnerAPIVersion [0.9.42]
@@ -17,4 +17,4 @@ public class Scanfile: ScanfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.162.0
20
+ // Generated with fastlane 2.163.0
@@ -260,4 +260,4 @@ public extension ScanfileProtocol {
260
260
 
261
261
  // Please don't remove the lines below
262
262
  // They are used to detect outdated files
263
- // FastlaneRunnerAPIVersion [0.9.53]
263
+ // FastlaneRunnerAPIVersion [0.9.54]
@@ -17,4 +17,4 @@ public class Screengrabfile: ScreengrabfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.162.0
20
+ // Generated with fastlane 2.163.0
@@ -96,4 +96,4 @@ public extension ScreengrabfileProtocol {
96
96
 
97
97
  // Please don't remove the lines below
98
98
  // They are used to detect outdated files
99
- // FastlaneRunnerAPIVersion [0.9.43]
99
+ // FastlaneRunnerAPIVersion [0.9.44]
@@ -17,4 +17,4 @@ public class Snapshotfile: SnapshotfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.162.0
20
+ // Generated with fastlane 2.163.0
@@ -184,4 +184,4 @@ public extension SnapshotfileProtocol {
184
184
 
185
185
  // Please don't remove the lines below
186
186
  // They are used to detect outdated files
187
- // FastlaneRunnerAPIVersion [0.9.37]
187
+ // FastlaneRunnerAPIVersion [0.9.38]
@@ -20,7 +20,7 @@ class MainProcess {
20
20
  @objc func connectToFastlaneAndRunLane() {
21
21
  runner.startSocketThread(port: argumentProcessor.port)
22
22
 
23
- let completedRun = Fastfile.runLane(from: nil, named: argumentProcessor.currentLane, parameters: argumentProcessor.laneParameters())
23
+ let completedRun = Fastfile.runLane(from: nil, named: argumentProcessor.currentLane, with: argumentProcessor.laneParameters())
24
24
  if completedRun {
25
25
  runner.disconnectFromFastlaneProcess()
26
26
  }
@@ -66,14 +66,14 @@ module Gym
66
66
  if path
67
67
  # Try to find IPA file in the output directory, used when app thinning was not set
68
68
  Gym.cache[:ipa_path] = File.join(temporary_output_path, "#{Gym.config[:output_name]}.ipa")
69
- FileUtils.mv(path, Gym.cache[:ipa_path]) unless File.expand_path(path).casecmp(File.expand_path(Gym.cache[:ipa_path]).downcase).zero?
69
+ FileUtils.mv(path, Gym.cache[:ipa_path]) unless File.expand_path(path).casecmp?(File.expand_path(Gym.cache[:ipa_path]).downcase)
70
70
  elsif Dir.exist?(apps_path)
71
71
  # Try to find "generic" IPA file inside "Apps" folder, used when app thinning was set
72
72
  files = Dir[File.join(apps_path, "*.ipa")]
73
73
  # Generic IPA file doesn't have suffix so its name is the shortest
74
74
  path = files.min_by(&:length)
75
75
  Gym.cache[:ipa_path] = File.join(temporary_output_path, "#{Gym.config[:output_name]}.ipa")
76
- FileUtils.cp(path, Gym.cache[:ipa_path]) unless File.expand_path(path).casecmp(File.expand_path(Gym.cache[:ipa_path]).downcase).zero?
76
+ FileUtils.cp(path, Gym.cache[:ipa_path]) unless File.expand_path(path).casecmp?(File.expand_path(Gym.cache[:ipa_path]).downcase)
77
77
  else
78
78
  ErrorHandler.handle_empty_archive unless path
79
79
  end
@@ -9,10 +9,16 @@ module Sigh
9
9
  class DownloadAll
10
10
  # Download all valid provisioning profiles
11
11
  def download_all(download_xcode_profiles: false)
12
- UI.message("Starting login with user '#{Sigh.config[:username]}'")
13
- Spaceship.login(Sigh.config[:username], nil)
14
- Spaceship.select_team
15
- UI.message("Successfully logged in")
12
+ if (token = api_token)
13
+ UI.message("Creating authorization token for App Store Connect API")
14
+ Spaceship::ConnectAPI.token = token
15
+ else
16
+ # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
17
+ # Prompts select team if multiple teams and none specified
18
+ UI.message("Starting login with user '#{Sigh.config[:username]}'")
19
+ Spaceship::ConnectAPI.login(Sigh.config[:username], nil, use_portal: true, use_tunes: false)
20
+ UI.message("Successfully logged in")
21
+ end
16
22
 
17
23
  if download_xcode_profiles
18
24
  UI.deprecated("The App Store Connect API does not support querying for Xcode managed profiles: --download_code_profiles is deprecated")
@@ -53,6 +59,12 @@ module Sigh
53
59
  download_profiles(profiles)
54
60
  end
55
61
 
62
+ def api_token
63
+ api_token ||= Spaceship::ConnectAPI::Token.create(Sigh.config[:api_key]) if Sigh.config[:api_key]
64
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(Sigh.config[:api_key_path]) if Sigh.config[:api_key_path]
65
+ return api_token
66
+ end
67
+
56
68
  # @param profiles [Array] Array of all the provisioning profiles we want to download
57
69
  def download_profiles(profiles)
58
70
  UI.important("No profiles available for download") if profiles.empty?
@@ -165,7 +165,11 @@ open class Snapshot: NSObject {
165
165
  }
166
166
 
167
167
  let screenshot = XCUIScreen.main.screenshot()
168
+ #if os(iOS)
168
169
  let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image
170
+ #else
171
+ let image = screenshot.image
172
+ #endif
169
173
 
170
174
  guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
171
175
 
@@ -858,9 +858,7 @@ module Spaceship
858
858
 
859
859
  resp_hash = response.to_hash
860
860
  if resp_hash[:status] == 401
861
- msg = "Auth lost"
862
- logger.warn(msg)
863
- raise UnauthorizedAccessError.new, "Unauthorized Access"
861
+ handle_401(response)
864
862
  end
865
863
 
866
864
  if response.body.to_s.include?("<title>302 Found</title>")
@@ -881,6 +879,12 @@ module Spaceship
881
879
  end
882
880
  end
883
881
 
882
+ def handle_401(response)
883
+ msg = "Auth lost"
884
+ logger.warn(msg)
885
+ raise UnauthorizedAccessError.new, "Unauthorized Access"
886
+ end
887
+
884
888
  def send_request_auto_paginate(method, url_or_path, params, headers, &block)
885
889
  response = send_request(method, url_or_path, params, headers, &block)
886
890
  return response unless should_process_next_rel?(response)
@@ -86,5 +86,29 @@ module Spaceship
86
86
  end
87
87
  end
88
88
  end
89
+
90
+ # Defined in the App Store Connect API docs:
91
+ #
92
+ # Used for creating BundleId and Device
93
+ module BundleIdPlatform
94
+ IOS = "IOS"
95
+ MAC_OS = "MAC_OS"
96
+
97
+ ALL = [IOS, MAC_OS]
98
+
99
+ def self.map(platform)
100
+ return platform if ALL.include?(platform)
101
+
102
+ # Map from fastlane input and Spaceship::TestFlight platform values
103
+ case platform.to_sym
104
+ when :osx, :macos, :mac
105
+ return Spaceship::ConnectAPI::Platform::MAC_OS
106
+ when :ios
107
+ return Spaceship::ConnectAPI::Platform::IOS
108
+ else
109
+ raise "Cannot find a matching platform for '#{platform}' - valid values are #{ALL.join(', ')}"
110
+ end
111
+ end
112
+ end
89
113
  end
90
114
  end
@@ -152,6 +152,7 @@ module Spaceship
152
152
 
153
153
  def with_asc_retry(tries = 5, &_block)
154
154
  tries = 1 if Object.const_defined?("SpecHelper")
155
+
155
156
  response = yield
156
157
 
157
158
  status = response.status if response
@@ -162,6 +163,10 @@ module Spaceship
162
163
  end
163
164
 
164
165
  return response
166
+ rescue UnauthorizedAccessError => error
167
+ # Catch unathorized access and re-raising
168
+ # There is no need to try again
169
+ raise error
165
170
  rescue => error
166
171
  tries -= 1
167
172
  puts(error) if Spaceship::Globals.verbose?
@@ -194,6 +199,10 @@ module Spaceship
194
199
  return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, client: self)
195
200
  end
196
201
 
202
+ def handle_401(response)
203
+ raise UnauthorizedAccessError, handle_errors(response) if response && (response.body || {})['errors']
204
+ end
205
+
197
206
  def handle_errors(response)
198
207
  # Example error format
199
208
  # {
@@ -48,6 +48,11 @@ module Spaceship
48
48
  resps = Spaceship::ConnectAPI.get_devices(filter: filter, includes: includes).all_pages
49
49
  return resps.flat_map(&:to_models)
50
50
  end
51
+
52
+ def self.create(name: nil, platform: nil, udid: nil)
53
+ resp = Spaceship::ConnectAPI.post_device(name: name, platform: platform, udid: udid)
54
+ return resp.to_models.first
55
+ end
51
56
  end
52
57
  end
53
58
  end
@@ -71,6 +71,23 @@ module Spaceship
71
71
  end
72
72
  end
73
73
 
74
+ def post_device(name: nil, platform: nil, udid: nil)
75
+ attributes = {
76
+ name: name,
77
+ platform: platform,
78
+ udid: udid
79
+ }
80
+
81
+ body = {
82
+ data: {
83
+ attributes: attributes,
84
+ type: "devices"
85
+ }
86
+ }
87
+
88
+ provisioning_request_client.post("devices", body)
89
+ end
90
+
74
91
  #
75
92
  # profiles
76
93
  #
@@ -1,4 +1,5 @@
1
1
  require 'jwt'
2
+ require 'base64'
2
3
  require 'openssl'
3
4
 
4
5
  # extract pem from .p8
@@ -39,7 +40,7 @@ module Spaceship
39
40
  self.create(json)
40
41
  end
41
42
 
42
- def self.create(key_id: nil, issuer_id: nil, filepath: nil, key: nil, duration: nil, in_house: nil)
43
+ def self.create(key_id: nil, issuer_id: nil, filepath: nil, key: nil, is_key_content_base64: false, duration: nil, in_house: nil)
43
44
  key_id ||= ENV['SPACESHIP_CONNECT_API_KEY_ID']
44
45
  issuer_id ||= ENV['SPACESHIP_CONNECT_API_ISSUER_ID']
45
46
  filepath ||= ENV['SPACESHIP_CONNECT_API_KEY_FILEPATH']
@@ -51,6 +52,10 @@ module Spaceship
51
52
  key ||= ENV['SPACESHIP_CONNECT_API_KEY']
52
53
  key ||= File.binread(filepath)
53
54
 
55
+ if !key.nil? && is_key_content_base64
56
+ key = Base64.decode64(key)
57
+ end
58
+
54
59
  self.new(
55
60
  key_id: key_id,
56
61
  issuer_id: issuer_id,
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.162.0
4
+ version: 2.163.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Daniel Jankowski
7
8
  - Kohki Miki
9
+ - Helmut Januschka
8
10
  - Danielle Tomlinson
9
- - Aaron Brager
10
11
  - Fumiya Nakamura
11
- - Maksym Grebenets
12
- - Felix Krause
13
12
  - Joshua Liebowitz
14
13
  - Jérôme Lacoste
14
+ - Aaron Brager
15
+ - Jorge Revuelta H
15
16
  - Iulian Onofrei
17
+ - Jimmy Dee
18
+ - Jan Piotrowski
19
+ - Luka Mirosevic
20
+ - Felix Krause
16
21
  - Max Ott
17
- - Daniel Jankowski
18
- - Josh Holtz
19
- - Olivier Halligon
20
22
  - Stefan Natchev
21
- - Andrew McBurney
22
- - Luka Mirosevic
23
- - Jimmy Dee
24
- - Matthew Ellis
25
23
  - Manu Wallner
26
- - Helmut Januschka
27
- - Jorge Revuelta H
28
- - Jan Piotrowski
24
+ - Matthew Ellis
25
+ - Josh Holtz
26
+ - Maksym Grebenets
27
+ - Andrew McBurney
28
+ - Olivier Halligon
29
29
  autorequire:
30
30
  bindir: bin
31
31
  cert_chain: []
32
- date: 2020-10-01 00:00:00.000000000 Z
32
+ date: 2020-10-12 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: slack-notifier
@@ -984,6 +984,8 @@ files:
984
984
  - fastlane/lib/fastlane/action.rb
985
985
  - fastlane/lib/fastlane/action_collector.rb
986
986
  - fastlane/lib/fastlane/actions/.git_commit.rb.swp
987
+ - fastlane/lib/fastlane/actions/.register_device.rb.swp
988
+ - fastlane/lib/fastlane/actions/.register_devices.rb.swp
987
989
  - fastlane/lib/fastlane/actions/README.md
988
990
  - fastlane/lib/fastlane/actions/actions_helper.rb
989
991
  - fastlane/lib/fastlane/actions/adb.rb