fastlane-plugin-firebase_app_distribution 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb +41 -34
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_add_testers_action.rb +8 -2
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_create_group_action.rb +7 -2
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_delete_group_action.rb +8 -2
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_latest_release.rb +7 -1
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb +8 -1
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_remove_testers_action.rb +8 -2
- data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_auth_client.rb +21 -9
- data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb +15 -15
- data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb +1 -16
- data/lib/fastlane/plugin/firebase_app_distribution/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e6ae8a63559822e0869de05d3b6239991ef11e137cfcaab8632bfcb5ebc131b
|
4
|
+
data.tar.gz: b4cc1e7840dc3a8a4b42bfeafa0da86d2ef6c6d2520dec19d1ac00bcb85a93f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ad2e974069de4be2bf38ca52f0d4c8d2a5569bb2e2673332207be9d417dd8aaf779bddf34ee04eb8b78e612a26d02a5c74668be6fc590b06470c60274a6f3d
|
7
|
+
data.tar.gz: 50bd7ff6e1fef81db8a695f5e3c6239c0170842efb0db85c0e025f9362c5b47ded84b555718cfb661e14952c44725b33fb9af2f49a6321e7e5e1cd546f9806f9
|
data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb
CHANGED
@@ -2,6 +2,7 @@ require 'fastlane/action'
|
|
2
2
|
require 'open3'
|
3
3
|
require 'shellwords'
|
4
4
|
require 'googleauth'
|
5
|
+
require 'google/apis/firebaseappdistribution_v1'
|
5
6
|
require_relative '../helper/firebase_app_distribution_helper'
|
6
7
|
require_relative '../helper/firebase_app_distribution_error_message'
|
7
8
|
require_relative '../helper/firebase_app_distribution_auth_client'
|
@@ -19,8 +20,8 @@ module Fastlane
|
|
19
20
|
extend Helper::FirebaseAppDistributionHelper
|
20
21
|
|
21
22
|
DEFAULT_UPLOAD_TIMEOUT_SECONDS = 300
|
22
|
-
|
23
|
-
|
23
|
+
UPLOAD_MAX_POLLING_RETRIES = 60
|
24
|
+
UPLOAD_POLLING_INTERVAL_SECONDS = 5
|
24
25
|
|
25
26
|
def self.run(params)
|
26
27
|
params.values # to validate all inputs before looking for the ipa/apk/aab
|
@@ -31,16 +32,16 @@ module Fastlane
|
|
31
32
|
timeout = get_upload_timeout(params)
|
32
33
|
|
33
34
|
binary_path = get_binary_path(platform, params)
|
34
|
-
UI.user_error!("Couldn't find binary") if binary_path.nil?
|
35
|
-
UI.user_error!("Couldn't find binary at path #{binary_path}") unless File.exist?(binary_path)
|
35
|
+
UI.user_error!("Couldn't find binary.") if binary_path.nil?
|
36
|
+
UI.user_error!("Couldn't find binary at path #{binary_path}.") unless File.exist?(binary_path)
|
36
37
|
binary_type = binary_type_from_path(binary_path)
|
37
38
|
|
38
39
|
# TODO(lkellogg): This sets the send timeout for all POST requests made by the client, but
|
39
40
|
# ideally the timeout should only apply to the binary upload
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
init_google_api_client(params[:debug], timeout)
|
42
|
+
authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
|
43
|
+
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
|
44
|
+
client.authorization = authorization
|
44
45
|
|
45
46
|
# If binary is an AAB, get the AAB info for this app, which includes the integration state
|
46
47
|
# and certificate data
|
@@ -50,9 +51,9 @@ module Fastlane
|
|
50
51
|
end
|
51
52
|
|
52
53
|
binary_type = binary_type_from_path(binary_path)
|
53
|
-
UI.message("
|
54
|
+
UI.message("📡 Uploading the #{binary_type}.")
|
54
55
|
operation = upload_binary(app_name, binary_path, client, timeout)
|
55
|
-
UI.message("🕵️ Validating upload
|
56
|
+
UI.message("🕵️ Validating upload…")
|
56
57
|
release = poll_upload_release_operation(client, operation, binary_type)
|
57
58
|
|
58
59
|
if binary_type == :AAB && aab_info && !aab_certs_included?(aab_info.test_certificate)
|
@@ -214,24 +215,22 @@ module Fastlane
|
|
214
215
|
end
|
215
216
|
|
216
217
|
def self.poll_upload_release_operation(client, operation, binary_type)
|
217
|
-
|
218
|
-
|
218
|
+
UPLOAD_MAX_POLLING_RETRIES.times do
|
219
|
+
sleep(UPLOAD_POLLING_INTERVAL_SECONDS)
|
220
|
+
operation = client.get_project_app_release_operation(operation.name)
|
219
221
|
if operation.done && operation.response && operation.response['release']
|
220
222
|
release = extract_release(operation)
|
221
|
-
|
222
|
-
|
223
|
+
case operation.response['result']
|
224
|
+
when 'RELEASE_UPDATED'
|
223
225
|
UI.success("✅ Uploaded #{binary_type} successfully; updated provisioning profile of existing release #{release_version(release)}.")
|
224
|
-
|
225
|
-
elsif result == 'RELEASE_UNMODIFIED'
|
226
|
+
when 'RELEASE_UNMODIFIED'
|
226
227
|
UI.success("✅ The same #{binary_type} was found in release #{release_version(release)} with no changes, skipping.")
|
227
|
-
break
|
228
228
|
else
|
229
229
|
UI.success("✅ Uploaded #{binary_type} successfully and created release #{release_version(release)}.")
|
230
230
|
end
|
231
231
|
break
|
232
232
|
elsif !operation.done
|
233
|
-
|
234
|
-
operation = client.get_project_app_release_operation(operation.name)
|
233
|
+
next
|
235
234
|
else
|
236
235
|
if operation.error && operation.error.message
|
237
236
|
UI.user_error!("#{ErrorMessage.upload_binary_error(binary_type)}: #{operation.error.message}")
|
@@ -350,7 +349,7 @@ module Fastlane
|
|
350
349
|
verify_block: proc do |value|
|
351
350
|
UI.user_error!("firebase_app_distribution: '#{value}' is not a valid value for android_artifact_type. Should be 'APK' or 'AAB'") unless ['APK', 'AAB'].include?(value)
|
352
351
|
end),
|
353
|
-
#
|
352
|
+
# General
|
354
353
|
FastlaneCore::ConfigItem.new(key: :app,
|
355
354
|
env_name: "FIREBASEAPPDISTRO_APP",
|
356
355
|
description: "Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page",
|
@@ -361,6 +360,18 @@ module Fastlane
|
|
361
360
|
env_name: "FIREBASEAPPDISTRO_FIREBASE_CLI_PATH",
|
362
361
|
description: "The absolute path of the firebase cli command",
|
363
362
|
type: String),
|
363
|
+
FastlaneCore::ConfigItem.new(key: :debug,
|
364
|
+
description: "Print verbose debug output",
|
365
|
+
optional: true,
|
366
|
+
default_value: false,
|
367
|
+
type: Boolean),
|
368
|
+
|
369
|
+
# Release Distribution
|
370
|
+
FastlaneCore::ConfigItem.new(key: :upload_timeout,
|
371
|
+
description: "Amount of seconds before the upload will timeout, if not completed",
|
372
|
+
optional: true,
|
373
|
+
default_value: DEFAULT_UPLOAD_TIMEOUT_SECONDS,
|
374
|
+
type: Integer),
|
364
375
|
FastlaneCore::ConfigItem.new(key: :groups,
|
365
376
|
env_name: "FIREBASEAPPDISTRO_GROUPS",
|
366
377
|
description: "The group aliases used for distribution, separated by commas",
|
@@ -368,17 +379,17 @@ module Fastlane
|
|
368
379
|
type: String),
|
369
380
|
FastlaneCore::ConfigItem.new(key: :groups_file,
|
370
381
|
env_name: "FIREBASEAPPDISTRO_GROUPS_FILE",
|
371
|
-
description: "
|
382
|
+
description: "Path to file containing group aliases used for distribution, separated by commas",
|
372
383
|
optional: true,
|
373
384
|
type: String),
|
374
385
|
FastlaneCore::ConfigItem.new(key: :testers,
|
375
386
|
env_name: "FIREBASEAPPDISTRO_TESTERS",
|
376
|
-
description: "
|
387
|
+
description: "Email addresses of testers, separated by commas",
|
377
388
|
optional: true,
|
378
389
|
type: String),
|
379
390
|
FastlaneCore::ConfigItem.new(key: :testers_file,
|
380
391
|
env_name: "FIREBASEAPPDISTRO_TESTERS_FILE",
|
381
|
-
description: "
|
392
|
+
description: "Path to file containing email addresses of testers, separated by commas",
|
382
393
|
optional: true,
|
383
394
|
type: String),
|
384
395
|
FastlaneCore::ConfigItem.new(key: :release_notes,
|
@@ -388,27 +399,23 @@ module Fastlane
|
|
388
399
|
type: String),
|
389
400
|
FastlaneCore::ConfigItem.new(key: :release_notes_file,
|
390
401
|
env_name: "FIREBASEAPPDISTRO_RELEASE_NOTES_FILE",
|
391
|
-
description: "
|
402
|
+
description: "Path to file containing release notes for this build",
|
392
403
|
optional: true,
|
393
404
|
type: String),
|
405
|
+
|
406
|
+
# Auth
|
394
407
|
FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
|
395
408
|
description: "Auth token generated using the Firebase CLI's login:ci command",
|
396
409
|
optional: true,
|
397
410
|
type: String),
|
398
|
-
FastlaneCore::ConfigItem.new(key: :debug,
|
399
|
-
description: "Print verbose debug output",
|
400
|
-
optional: true,
|
401
|
-
default_value: false,
|
402
|
-
is_string: false),
|
403
411
|
FastlaneCore::ConfigItem.new(key: :service_credentials_file,
|
404
|
-
description: "Path to Google service account json",
|
412
|
+
description: "Path to Google service account json file",
|
405
413
|
optional: true,
|
406
414
|
type: String),
|
407
|
-
FastlaneCore::ConfigItem.new(key: :
|
408
|
-
description: "
|
415
|
+
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
|
416
|
+
description: "Google service account json file content",
|
409
417
|
optional: true,
|
410
|
-
|
411
|
-
type: Integer)
|
418
|
+
type: String)
|
412
419
|
]
|
413
420
|
end
|
414
421
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'fastlane/action'
|
2
2
|
require 'fastlane_core/ui/ui'
|
3
|
-
|
3
|
+
require 'google/apis/firebaseappdistribution_v1'
|
4
4
|
require_relative '../helper/firebase_app_distribution_helper'
|
5
5
|
require_relative '../helper/firebase_app_distribution_auth_client'
|
6
6
|
|
@@ -11,7 +11,9 @@ module Fastlane
|
|
11
11
|
extend Helper::FirebaseAppDistributionHelper
|
12
12
|
|
13
13
|
def self.run(params)
|
14
|
-
|
14
|
+
init_google_api_client(params[:debug])
|
15
|
+
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
|
16
|
+
client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
|
15
17
|
|
16
18
|
if blank?(params[:emails]) && blank?(params[:file])
|
17
19
|
UI.user_error!("Must specify `emails` or `file`.")
|
@@ -78,6 +80,10 @@ module Fastlane
|
|
78
80
|
description: "Path to Google service credentials file",
|
79
81
|
optional: true,
|
80
82
|
type: String),
|
83
|
+
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
|
84
|
+
description: "Google service account json file content",
|
85
|
+
optional: true,
|
86
|
+
type: String),
|
81
87
|
FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
|
82
88
|
description: "Auth token generated using the Firebase CLI's login:ci command",
|
83
89
|
optional: true,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'fastlane/action'
|
2
2
|
require 'fastlane_core/ui/ui'
|
3
3
|
require 'google/apis/firebaseappdistribution_v1'
|
4
|
-
|
5
4
|
require_relative '../helper/firebase_app_distribution_helper'
|
6
5
|
require_relative '../helper/firebase_app_distribution_auth_client'
|
7
6
|
|
@@ -20,7 +19,9 @@ module Fastlane
|
|
20
19
|
UI.user_error!("Must specify `display_name`.")
|
21
20
|
end
|
22
21
|
|
23
|
-
|
22
|
+
init_google_api_client(params[:debug])
|
23
|
+
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
|
24
|
+
client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
|
24
25
|
|
25
26
|
project_number = params[:project_number]
|
26
27
|
group_alias = params[:alias]
|
@@ -86,6 +87,10 @@ module Fastlane
|
|
86
87
|
description: "Path to Google service credentials file",
|
87
88
|
optional: true,
|
88
89
|
type: String),
|
90
|
+
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
|
91
|
+
description: "Google service account json file content",
|
92
|
+
optional: true,
|
93
|
+
type: String),
|
89
94
|
FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
|
90
95
|
description: "Auth token generated using the Firebase CLI's login:ci command",
|
91
96
|
optional: true,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'fastlane/action'
|
2
2
|
require 'fastlane_core/ui/ui'
|
3
|
-
|
3
|
+
require 'google/apis/firebaseappdistribution_v1'
|
4
4
|
require_relative '../helper/firebase_app_distribution_helper'
|
5
5
|
require_relative '../helper/firebase_app_distribution_auth_client'
|
6
6
|
|
@@ -11,7 +11,9 @@ module Fastlane
|
|
11
11
|
extend Helper::FirebaseAppDistributionHelper
|
12
12
|
|
13
13
|
def self.run(params)
|
14
|
-
|
14
|
+
init_google_api_client(params[:debug])
|
15
|
+
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
|
16
|
+
client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
|
15
17
|
|
16
18
|
if blank?(params[:alias])
|
17
19
|
UI.user_error!("Must specify `alias`.")
|
@@ -65,6 +67,10 @@ module Fastlane
|
|
65
67
|
description: "Path to Google service credentials file",
|
66
68
|
optional: true,
|
67
69
|
type: String),
|
70
|
+
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
|
71
|
+
description: "Google service account json file content",
|
72
|
+
optional: true,
|
73
|
+
type: String),
|
68
74
|
FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
|
69
75
|
description: "Auth token generated using the Firebase CLI's login:ci command",
|
70
76
|
optional: true,
|
@@ -13,7 +13,9 @@ module Fastlane
|
|
13
13
|
extend Helper::FirebaseAppDistributionHelper
|
14
14
|
|
15
15
|
def self.run(params)
|
16
|
-
|
16
|
+
init_google_api_client(params[:debug])
|
17
|
+
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
|
18
|
+
client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
|
17
19
|
|
18
20
|
UI.message("⏳ Fetching latest release for app #{params[:app]}...")
|
19
21
|
|
@@ -89,6 +91,10 @@ module Fastlane
|
|
89
91
|
description: "Path to Google service account json",
|
90
92
|
optional: true,
|
91
93
|
type: String),
|
94
|
+
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
|
95
|
+
description: "Google service account json file content",
|
96
|
+
optional: true,
|
97
|
+
type: String),
|
92
98
|
FastlaneCore::ConfigItem.new(key: :debug,
|
93
99
|
description: "Print verbose debug output",
|
94
100
|
optional: true,
|
data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb
CHANGED
@@ -2,6 +2,7 @@ require 'fastlane/action'
|
|
2
2
|
require 'open3'
|
3
3
|
require 'shellwords'
|
4
4
|
require 'googleauth'
|
5
|
+
require 'google/apis/firebaseappdistribution_v1alpha'
|
5
6
|
require_relative '../helper/firebase_app_distribution_helper'
|
6
7
|
require_relative '../helper/firebase_app_distribution_error_message'
|
7
8
|
require_relative '../helper/firebase_app_distribution_auth_client'
|
@@ -13,7 +14,9 @@ module Fastlane
|
|
13
14
|
extend Helper::FirebaseAppDistributionHelper
|
14
15
|
|
15
16
|
def self.run(params)
|
16
|
-
|
17
|
+
init_google_api_client(params[:debug])
|
18
|
+
client = Google::Apis::FirebaseappdistributionV1alpha::FirebaseAppDistributionService.new
|
19
|
+
client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
|
17
20
|
|
18
21
|
project_number = params[:project_number]
|
19
22
|
if blank?(project_number)
|
@@ -83,6 +86,10 @@ module Fastlane
|
|
83
86
|
description: "Path to Google service account json",
|
84
87
|
optional: true,
|
85
88
|
type: String),
|
89
|
+
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
|
90
|
+
description: "Google service account json file content",
|
91
|
+
optional: true,
|
92
|
+
type: String),
|
86
93
|
FastlaneCore::ConfigItem.new(key: :debug,
|
87
94
|
description: "Print verbose debug output",
|
88
95
|
optional: true,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'fastlane/action'
|
2
2
|
require 'fastlane_core/ui/ui'
|
3
|
-
|
3
|
+
require 'google/apis/firebaseappdistribution_v1'
|
4
4
|
require_relative '../helper/firebase_app_distribution_helper'
|
5
5
|
require_relative '../helper/firebase_app_distribution_auth_client'
|
6
6
|
|
@@ -11,7 +11,9 @@ module Fastlane
|
|
11
11
|
extend Helper::FirebaseAppDistributionHelper
|
12
12
|
|
13
13
|
def self.run(params)
|
14
|
-
|
14
|
+
init_google_api_client(params[:debug])
|
15
|
+
client = Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new
|
16
|
+
client.authorization = get_authorization(params[:service_credentials_file], params[:firebase_cli_token], params[:service_credentials_json_data], params[:debug])
|
15
17
|
|
16
18
|
if blank?(params[:emails]) && blank?(params[:file])
|
17
19
|
UI.user_error!("Must specify `emails` or `file`.")
|
@@ -73,6 +75,10 @@ module Fastlane
|
|
73
75
|
description: "Path to Google service credentials file",
|
74
76
|
optional: true,
|
75
77
|
type: String),
|
78
|
+
FastlaneCore::ConfigItem.new(key: :service_credentials_json_data,
|
79
|
+
description: "Google service account json file content",
|
80
|
+
optional: true,
|
81
|
+
type: String),
|
76
82
|
FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
|
77
83
|
description: "Auth token generated using the Firebase CLI's login:ci command",
|
78
84
|
optional: true,
|
data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_auth_client.rb
CHANGED
@@ -20,6 +20,7 @@ module Fastlane
|
|
20
20
|
# auth method is used, unset all other auth variables/parameters to nil/empty
|
21
21
|
#
|
22
22
|
# args
|
23
|
+
# google_service_json_data - Google service account json file content as a string
|
23
24
|
# google_service_path - Absolute path to the Google service account file
|
24
25
|
# firebase_cli_token - Refresh token
|
25
26
|
# debug - Whether to enable debug-level logging
|
@@ -28,10 +29,13 @@ module Fastlane
|
|
28
29
|
# FIREBASE_TOKEN - see firebase_cli_token
|
29
30
|
#
|
30
31
|
# Crashes if given invalid or missing credentials
|
31
|
-
def get_authorization(google_service_path, firebase_cli_token, debug = false)
|
32
|
+
def get_authorization(google_service_path, firebase_cli_token, google_service_json_data, debug = false)
|
32
33
|
if !google_service_path.nil? && !google_service_path.empty?
|
33
34
|
UI.message("🔐 Authenticating with --service_credentials_file path parameter: #{google_service_path}")
|
34
|
-
|
35
|
+
service_account_from_file(google_service_path, debug)
|
36
|
+
elsif !google_service_json_data.nil? && !google_service_json_data.empty?
|
37
|
+
UI.message("🔐 Authenticating with --service_credentials_json content parameter")
|
38
|
+
service_account_from_json(google_service_json_data, debug)
|
35
39
|
elsif !firebase_cli_token.nil? && !firebase_cli_token.empty?
|
36
40
|
UI.message("🔐 Authenticating with --firebase_cli_token parameter")
|
37
41
|
firebase_token(firebase_cli_token, debug)
|
@@ -100,24 +104,32 @@ module Fastlane
|
|
100
104
|
UI.user_error!(error_message)
|
101
105
|
end
|
102
106
|
|
103
|
-
def
|
107
|
+
def service_account_from_json(google_service_json_data, debug)
|
108
|
+
get_service_account_credentials(google_service_json_data, debug)
|
109
|
+
end
|
110
|
+
|
111
|
+
def service_account_from_file(google_service_path, debug)
|
112
|
+
get_service_account_credentials(File.read(google_service_path), debug)
|
113
|
+
rescue Errno::ENOENT
|
114
|
+
UI.user_error!("#{ErrorMessage::SERVICE_CREDENTIALS_NOT_FOUND}: #{google_service_path}")
|
115
|
+
end
|
116
|
+
|
117
|
+
def get_service_account_credentials(json_data, debug)
|
118
|
+
json_file = JSON.parse(json_data)
|
104
119
|
# check if it's an external account or service account
|
105
|
-
json_file = JSON.parse(File.read(google_service_path))
|
106
120
|
auth = json_file["type"] == "external_account" ? Google::Auth::ExternalAccount::Credentials : Google::Auth::ServiceAccountCredentials
|
107
121
|
service_account_credentials = auth.make_creds(
|
108
|
-
json_key_io:
|
122
|
+
json_key_io: StringIO.new(json_data),
|
109
123
|
scope: SCOPE
|
110
124
|
)
|
111
125
|
service_account_credentials.fetch_access_token!
|
112
126
|
service_account_credentials
|
113
|
-
rescue Errno::ENOENT
|
114
|
-
UI.user_error!("#{ErrorMessage::SERVICE_CREDENTIALS_NOT_FOUND}: #{google_service_path}")
|
115
127
|
rescue Signet::AuthorizationError => error
|
116
|
-
error_message = "#{ErrorMessage::SERVICE_CREDENTIALS_ERROR}:
|
128
|
+
error_message = "#{ErrorMessage::SERVICE_CREDENTIALS_ERROR}: "
|
117
129
|
if debug
|
118
130
|
error_message += "\n#{error_details(error)}"
|
119
131
|
else
|
120
|
-
error_message +=
|
132
|
+
error_message += debug_instructions.to_s
|
121
133
|
end
|
122
134
|
UI.user_error!(error_message)
|
123
135
|
end
|
data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
1
|
module ErrorMessage
|
2
2
|
MISSING_CREDENTIALS = "Missing authentication credentials. Set up Application Default Credentials, your Firebase refresh token, or sign in with the Firebase CLI, and try again."
|
3
|
-
MISSING_APP_ID = "Missing app id. Please check that the app parameter is set and try again"
|
4
|
-
SERVICE_CREDENTIALS_NOT_FOUND = "Service credentials file does not exist. Please check the service credentials path and try again"
|
5
|
-
PARSE_SERVICE_CREDENTIALS_ERROR = "Failed to extract service account information from the service credentials file"
|
6
|
-
PARSE_FIREBASE_TOOLS_JSON_ERROR = "Encountered error parsing json file. Ensure the firebase-tools.json file is formatted correctly"
|
7
|
-
UPLOAD_RELEASE_NOTES_ERROR = "App Distribution halted because it had a problem uploading release notes"
|
8
|
-
UPLOAD_TESTERS_ERROR = "App Distribution halted because it had a problem adding testers/groups"
|
9
|
-
GET_RELEASE_TIMEOUT = "App Distribution failed to fetch release information"
|
3
|
+
MISSING_APP_ID = "Missing app id. Please check that the app parameter is set and try again."
|
4
|
+
SERVICE_CREDENTIALS_NOT_FOUND = "Service credentials file does not exist. Please check the service credentials path and try again."
|
5
|
+
PARSE_SERVICE_CREDENTIALS_ERROR = "Failed to extract service account information from the service credentials file."
|
6
|
+
PARSE_FIREBASE_TOOLS_JSON_ERROR = "Encountered error parsing json file. Ensure the firebase-tools.json file is formatted correctly."
|
7
|
+
UPLOAD_RELEASE_NOTES_ERROR = "App Distribution halted because it had a problem uploading release notes."
|
8
|
+
UPLOAD_TESTERS_ERROR = "App Distribution halted because it had a problem adding testers/groups."
|
9
|
+
GET_RELEASE_TIMEOUT = "App Distribution failed to fetch release information."
|
10
10
|
REFRESH_TOKEN_ERROR = "App Distribution could not generate credentials from the refresh token specified."
|
11
|
-
APP_NOT_ONBOARDED_ERROR = "App Distribution not onboarded"
|
11
|
+
APP_NOT_ONBOARDED_ERROR = "App Distribution not onboarded."
|
12
12
|
INVALID_APP_ID = "App Distribution could not find your app. Make sure to onboard your app by pressing the \"Get started\" button on the App Distribution page in the Firebase console: https://console.firebase.google.com/project/_/appdistribution. App ID"
|
13
13
|
INVALID_PROJECT = "App Distribution could not find your Firebase project. Make sure to onboard an app in your project by pressing the \"Get started\" button on the App Distribution page in the Firebase console: https://console.firebase.google.com/project/_/appdistribution."
|
14
14
|
INVALID_PATH = "Could not read content from"
|
15
15
|
INVALID_TESTERS = "Could not enable access for testers. Check that the tester emails are formatted correctly, the groups exist and you are using group aliases (not group names) for specifying groups."
|
16
16
|
INVALID_TESTER_GROUP = "App Distribution could not find your tester group. Make sure that it exists before trying to add testers, and that the group alias is specified correctly."
|
17
17
|
INVALID_TESTER_GROUP_NAME = "The tester group name should be 4-63 characters, and valid characters are /[a-z][0-9]-/."
|
18
|
-
INVALID_RELEASE_NOTES = "Failed to set release notes"
|
19
|
-
SERVICE_CREDENTIALS_ERROR = "App Distribution could not generate credentials from the service credentials file specified"
|
18
|
+
INVALID_RELEASE_NOTES = "Failed to set release notes."
|
19
|
+
SERVICE_CREDENTIALS_ERROR = "App Distribution could not generate credentials from the service credentials file specified."
|
20
20
|
PLAY_ACCOUNT_NOT_LINKED = "This project is not linked to a Google Play account."
|
21
21
|
APP_NOT_PUBLISHED = "This app is not published in the Google Play console."
|
22
22
|
NO_APP_WITH_GIVEN_BUNDLE_ID_IN_PLAY_ACCOUNT = "App with matching package name does not exist in Google Play."
|
23
23
|
PLAY_IAS_TERMS_NOT_ACCEPTED = "You must accept the Play Internal App Sharing (IAS) terms to upload AABs."
|
24
24
|
INVALID_EMAIL_ADDRESS = "You passed an invalid email address."
|
25
|
-
TESTER_LIMIT_VIOLATION = "Creating testers would exceed tester limit"
|
25
|
+
TESTER_LIMIT_VIOLATION = "Creating testers would exceed tester limit."
|
26
26
|
|
27
27
|
def self.aab_upload_error(aab_state)
|
28
28
|
"Failed to process the AAB: #{aab_state}"
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.binary_not_found(binary_type)
|
32
|
-
"Could not find the #{binary_type}. Make sure you set the #{binary_type} path parameter to point to your #{binary_type}"
|
32
|
+
"Could not find the #{binary_type}. Make sure you set the #{binary_type} path parameter to point to your #{binary_type}."
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.parse_binary_metadata_error(binary_type)
|
36
|
-
"Failed to extract #{binary_type} metadata from the #{binary_type} path"
|
36
|
+
"Failed to extract #{binary_type} metadata from the #{binary_type} path."
|
37
37
|
end
|
38
38
|
|
39
39
|
def self.upload_binary_error(binary_type)
|
40
|
-
"App Distribution halted because it had a problem uploading the #{binary_type}"
|
40
|
+
"App Distribution halted because it had a problem uploading the #{binary_type}."
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.binary_processing_error(binary_type)
|
44
|
-
"App Distribution failed to process the #{binary_type}"
|
44
|
+
"App Distribution failed to process the #{binary_type}."
|
45
45
|
end
|
46
46
|
end
|
data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'fastlane_core/ui/ui'
|
2
|
-
require 'google/apis/firebaseappdistribution_v1'
|
3
|
-
require 'google/apis/firebaseappdistribution_v1alpha'
|
4
2
|
require 'cfpropertylist'
|
5
3
|
|
6
4
|
module Fastlane
|
@@ -72,17 +70,7 @@ module Fastlane
|
|
72
70
|
"#{project_name(project_number)}/groups/#{group_alias}"
|
73
71
|
end
|
74
72
|
|
75
|
-
def
|
76
|
-
init_client(Google::Apis::FirebaseappdistributionV1::FirebaseAppDistributionService.new,
|
77
|
-
service_credentials_file, firebase_cli_token, debug, timeout)
|
78
|
-
end
|
79
|
-
|
80
|
-
def init_v1alpha_client(service_credentials_file, firebase_cli_token, debug, timeout = nil)
|
81
|
-
init_client(Google::Apis::FirebaseappdistributionV1alpha::FirebaseAppDistributionService.new,
|
82
|
-
service_credentials_file, firebase_cli_token, debug, timeout)
|
83
|
-
end
|
84
|
-
|
85
|
-
def init_client(client, service_credentials_file, firebase_cli_token, debug, timeout = nil)
|
73
|
+
def init_google_api_client(debug, timeout = nil)
|
86
74
|
if debug
|
87
75
|
UI.important("Warning: Debug logging enabled. Output may include sensitive information.")
|
88
76
|
Google::Apis.logger.level = Logger::DEBUG
|
@@ -93,9 +81,6 @@ module Fastlane
|
|
93
81
|
unless timeout.nil?
|
94
82
|
Google::Apis::ClientOptions.default.send_timeout_sec = timeout
|
95
83
|
end
|
96
|
-
|
97
|
-
client.authorization = get_authorization(service_credentials_file, firebase_cli_token, debug)
|
98
|
-
client
|
99
84
|
end
|
100
85
|
|
101
86
|
def deep_symbolize_keys(hash)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-firebase_app_distribution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Natchev
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-01-
|
13
|
+
date: 2024-01-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: google-apis-firebaseappdistribution_v1
|