fastlane 2.162.0 → 2.167.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +78 -78
- data/cert/lib/cert/runner.rb +2 -2
- data/deliver/lib/deliver/app_screenshot.rb +6 -2
- data/deliver/lib/deliver/module.rb +2 -0
- data/deliver/lib/deliver/options.rb +3 -3
- data/deliver/lib/deliver/queue_worker.rb +14 -29
- data/deliver/lib/deliver/upload_metadata.rb +19 -5
- data/deliver/lib/deliver/upload_screenshots.rb +3 -5
- data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
- data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
- data/fastlane/lib/fastlane/actions/add_git_tag.rb +9 -2
- data/fastlane/lib/fastlane/actions/app_store_build_number.rb +39 -3
- data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +9 -0
- data/fastlane/lib/fastlane/actions/appledoc.rb +1 -1
- data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +1 -0
- data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +5 -1
- data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +9 -0
- data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -0
- data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -0
- data/fastlane/lib/fastlane/actions/import_from_git.rb +9 -1
- data/fastlane/lib/fastlane/actions/is_ci.rb +1 -1
- data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +15 -0
- data/fastlane/lib/fastlane/actions/register_device.rb +46 -5
- data/fastlane/lib/fastlane/actions/register_devices.rb +50 -16
- data/fastlane/lib/fastlane/actions/set_changelog.rb +31 -3
- data/fastlane/lib/fastlane/actions/spm.rb +6 -0
- data/fastlane/lib/fastlane/actions/sync_code_signing.rb +1 -0
- data/fastlane/lib/fastlane/actions/update_fastlane.rb +29 -8
- data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -2
- data/fastlane/lib/fastlane/cli_tools_distributor.rb +2 -2
- data/fastlane/lib/fastlane/fast_file.rb +74 -23
- data/fastlane/lib/fastlane/features.rb +1 -1
- data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +2 -0
- data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
- data/fastlane/lib/fastlane/version.rb +1 -1
- data/fastlane/swift/Deliverfile.swift +1 -1
- data/fastlane/swift/DeliverfileProtocol.swift +4 -4
- data/fastlane/swift/Fastfile.swift +1 -1
- data/fastlane/swift/Fastlane.swift +73 -22
- data/fastlane/swift/Gymfile.swift +1 -1
- data/fastlane/swift/GymfileProtocol.swift +1 -1
- data/fastlane/swift/LaneFileProtocol.swift +15 -19
- data/fastlane/swift/MainProcess.swift +3 -1
- data/fastlane/swift/Matchfile.swift +1 -1
- data/fastlane/swift/MatchfileProtocol.swift +6 -2
- data/fastlane/swift/Precheckfile.swift +1 -1
- data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
- data/fastlane/swift/Runner.swift +1 -1
- data/fastlane/swift/Scanfile.swift +1 -1
- data/fastlane/swift/ScanfileProtocol.swift +5 -1
- data/fastlane/swift/Screengrabfile.swift +1 -1
- data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
- data/fastlane/swift/Snapshotfile.swift +1 -1
- data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
- data/fastlane/swift/SocketClient.swift +1 -1
- data/fastlane/swift/main.swift +1 -1
- data/fastlane_core/lib/fastlane_core/cert_checker.rb +12 -7
- data/fastlane_core/lib/fastlane_core/device_manager.rb +8 -4
- data/fastlane_core/lib/fastlane_core/helper.rb +10 -2
- data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -3
- data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -1
- data/fastlane_core/lib/fastlane_core/provisioning_profile.rb +3 -1
- data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +8 -0
- data/gym/lib/gym/code_signing_mapping.rb +1 -1
- data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
- data/match/lib/match/importer.rb +33 -21
- data/match/lib/match/nuke.rb +9 -5
- data/match/lib/match/options.rb +7 -1
- data/pilot/lib/pilot/build_manager.rb +9 -3
- data/scan/lib/scan/detect_values.rb +8 -9
- data/scan/lib/scan/module.rb +4 -0
- data/scan/lib/scan/options.rb +9 -0
- data/scan/lib/scan/runner.rb +2 -1
- data/sigh/lib/assets/resign.sh +1 -1
- data/sigh/lib/sigh/download_all.rb +16 -4
- data/sigh/lib/sigh/runner.rb +4 -4
- data/snapshot/lib/assets/SnapshotHelper.swift +4 -0
- data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
- data/snapshot/lib/snapshot/test_command_generator.rb +1 -1
- data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
- data/snapshot/lib/snapshot/test_command_generator_xcode_8.rb +1 -1
- data/spaceship/lib/spaceship/client.rb +7 -3
- data/spaceship/lib/spaceship/connect_api.rb +26 -0
- data/spaceship/lib/spaceship/connect_api/api_client.rb +9 -0
- data/spaceship/lib/spaceship/connect_api/client.rb +7 -4
- data/spaceship/lib/spaceship/connect_api/models/app.rb +51 -0
- data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +9 -0
- data/spaceship/lib/spaceship/connect_api/models/custom_app_organization.rb +43 -0
- data/spaceship/lib/spaceship/connect_api/models/custom_app_user.rb +41 -0
- data/spaceship/lib/spaceship/connect_api/models/device.rb +5 -0
- data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +17 -0
- data/spaceship/lib/spaceship/connect_api/spaceship.rb +7 -4
- data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
- data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
- data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +71 -0
- data/supply/lib/supply.rb +1 -1
- data/supply/lib/supply/uploader.rb +1 -1
- metadata +21 -18
Binary file
|
@@ -5,7 +5,7 @@ module Fastlane
|
|
5
5
|
PLATFORM_NAME = :PLATFORM_NAME
|
6
6
|
ENVIRONMENT = :ENVIRONMENT
|
7
7
|
|
8
|
-
# A
|
8
|
+
# A slightly decorated hash that will store and fetch sensitive data
|
9
9
|
# but not display it while iterating keys and values
|
10
10
|
class LaneContextValues < Hash
|
11
11
|
def initialize
|
@@ -6,7 +6,13 @@ module Fastlane
|
|
6
6
|
# lane name in lane_context could be nil because you can just call $fastlane add_git_tag which has no context
|
7
7
|
lane_name = Actions.lane_context[Actions::SharedValues::LANE_NAME].to_s.delete(' ') # no spaces allowed
|
8
8
|
|
9
|
-
|
9
|
+
if options[:tag]
|
10
|
+
tag = options[:tag]
|
11
|
+
elsif options[:build_number]
|
12
|
+
tag = "#{options[:grouping]}/#{lane_name}/#{options[:prefix]}#{options[:build_number]}#{options[:postfix]}"
|
13
|
+
else
|
14
|
+
UI.user_error!("No value found for 'tag' or 'build_number'. At least one of them must be provided. Note that if you do specify a tag, all other arguments are ignored.")
|
15
|
+
end
|
10
16
|
message = options[:message] || "#{tag} (fastlane)"
|
11
17
|
|
12
18
|
cmd = ['git tag']
|
@@ -64,7 +70,8 @@ module Fastlane
|
|
64
70
|
description: "The build number. Defaults to the result of increment_build_number if you\'re using it",
|
65
71
|
default_value: Actions.lane_context[Actions::SharedValues::BUILD_NUMBER],
|
66
72
|
default_value_dynamic: true,
|
67
|
-
is_string: false
|
73
|
+
is_string: false,
|
74
|
+
optional: true),
|
68
75
|
FastlaneCore::ConfigItem.new(key: :message,
|
69
76
|
env_name: "FL_GIT_TAG_MESSAGE",
|
70
77
|
description: "The tag message. Defaults to the tag's name",
|
@@ -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
|
-
|
31
|
-
|
32
|
-
|
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",
|
@@ -55,7 +55,7 @@ module Fastlane
|
|
55
55
|
|
56
56
|
def self.run(params)
|
57
57
|
unless Helper.test?
|
58
|
-
UI.message("Install using `brew install
|
58
|
+
UI.message("Install using `brew install appledoc`")
|
59
59
|
UI.user_error!("appledoc not installed") if `which appledoc`.length == 0
|
60
60
|
end
|
61
61
|
|
@@ -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.
|
@@ -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
|
@@ -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
|
-
|
17
|
-
|
18
|
-
|
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
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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]
|
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,
|
68
|
-
Spaceship::Device.create
|
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,
|