fastlane-plugin-firebase_app_distribution 0.2.0.pre.2 → 0.2.0.pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb +2 -15
- data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb +6 -6
- data/lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb +19 -8
- data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb +4 -4
- data/lib/fastlane/plugin/firebase_app_distribution/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c591cb4a3b841f9fc26c94f3ff32b78b321ed904cc176e05a053e330543cd535
|
4
|
+
data.tar.gz: 0114a22cc34eec1970b5b280746b46b9d858407bbb5c1c7b3f3d54842e75b4d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 493da92f746defa50af47f9b2d920b65fa5fcbfbb085f0be74979fe7f26f684b78697be17c5e32eeac7fe1d0d78667ece5ef7198138358f6831870c382a5d753
|
7
|
+
data.tar.gz: 7afb5987aa4fd08032d4fa684b9c291d3c4dc762d2978b37bbe4e921ae5730a9a547819a49b61ee2d120617d961b13891b03f17f1ad48deb004eb125b658ad65
|
data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb
CHANGED
@@ -13,7 +13,6 @@ require_relative '../helper/firebase_app_distribution_auth_client'
|
|
13
13
|
module Fastlane
|
14
14
|
module Actions
|
15
15
|
class FirebaseAppDistributionAction < Action
|
16
|
-
DEFAULT_FIREBASE_CLI_PATH = `which firebase`
|
17
16
|
FIREBASECMD_ACTION = "appdistribution:distribute".freeze
|
18
17
|
|
19
18
|
extend Auth::FirebaseAppDistributionAuthClient
|
@@ -108,20 +107,8 @@ module Fastlane
|
|
108
107
|
FastlaneCore::ConfigItem.new(key: :firebase_cli_path,
|
109
108
|
env_name: "FIREBASEAPPDISTRO_FIREBASE_CLI_PATH",
|
110
109
|
description: "The absolute path of the firebase cli command",
|
111
|
-
|
112
|
-
|
113
|
-
optional: false,
|
114
|
-
type: String,
|
115
|
-
verify_block: proc do |value|
|
116
|
-
value.chomp!
|
117
|
-
if value.to_s == "" || !File.exist?(value)
|
118
|
-
UI.user_error!("firebase_cli_path: missing path to firebase cli tool. Please install firebase in $PATH or specify path")
|
119
|
-
end
|
120
|
-
|
121
|
-
unless is_firebasecmd_supported?(value)
|
122
|
-
UI.user_error!("firebase_cli_path: `#{value}` does not support the `#{FIREBASECMD_ACTION}` command. Please download (https://appdistro.page.link/firebase-cli-download) or specify the path to the correct version of firebse")
|
123
|
-
end
|
124
|
-
end),
|
110
|
+
optional: true,
|
111
|
+
type: String),
|
125
112
|
FastlaneCore::ConfigItem.new(key: :groups,
|
126
113
|
env_name: "FIREBASEAPPDISTRO_GROUPS",
|
127
114
|
description: "The groups used for distribution, separated by commas",
|
data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb
CHANGED
@@ -16,20 +16,20 @@ module Fastlane
|
|
16
16
|
authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, nil)
|
17
17
|
url = authorizer.get_authorization_url(base_url: OOB_URI)
|
18
18
|
|
19
|
-
UI.message("
|
19
|
+
UI.message("Open the following address in your browser and sign in with your Google account:")
|
20
20
|
UI.message(url)
|
21
21
|
UI.message("")
|
22
22
|
code = UI.input("Enter the resulting code here: ")
|
23
23
|
credentials = authorizer.get_credentials_from_code(code: code, base_url: OOB_URI)
|
24
|
-
|
25
|
-
UI.message("Refresh Token: #{credentials.refresh_token}")
|
26
24
|
UI.message("")
|
27
|
-
|
25
|
+
|
26
|
+
UI.success("Set the refresh token as the FIREBASE_TOKEN environment variable")
|
27
|
+
UI.success("Refresh Token: #{credentials.refresh_token}")
|
28
28
|
rescue Signet::AuthorizationError
|
29
|
-
UI.error("The code you entered
|
29
|
+
UI.error("The code you entered is invalid. Copy and paste the code and try again.")
|
30
30
|
rescue => error
|
31
31
|
UI.error(error.to_s)
|
32
|
-
UI.crash!("An error has occured please login again.")
|
32
|
+
UI.crash!("An error has occured, please login again.")
|
33
33
|
end
|
34
34
|
|
35
35
|
#####################################################
|
data/lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb
CHANGED
@@ -11,7 +11,10 @@ module Fastlane
|
|
11
11
|
|
12
12
|
def initialize(auth_token, platform)
|
13
13
|
@auth_token = auth_token
|
14
|
-
|
14
|
+
|
15
|
+
if platform.nil?
|
16
|
+
@binary_type = "IPA/APK"
|
17
|
+
elsif platform == :ios
|
15
18
|
@binary_type = "IPA"
|
16
19
|
else
|
17
20
|
@binary_type = "APK"
|
@@ -70,26 +73,34 @@ module Fastlane
|
|
70
73
|
# rescue Faraday::ClientError
|
71
74
|
# UI.user_error!("#{ErrorMessage::INVALID_RELEASE_ID}: #{release_id}")
|
72
75
|
end
|
73
|
-
UI.success("
|
76
|
+
UI.success("Posted release notes.")
|
74
77
|
end
|
75
78
|
|
79
|
+
# Returns the url encoded upload token used for get_upload_status calls:
|
80
|
+
# projects/<project-number>/apps/<app-id>/releases/-/binaries/<binary-hash>
|
81
|
+
#
|
82
|
+
# args
|
83
|
+
# app_id - Firebase App ID
|
84
|
+
# binary_path - Absolute path to your app's apk/ipa file
|
85
|
+
#
|
86
|
+
# Throws a user_error if an invalid app id is passed in, the binary file does
|
87
|
+
# not exist, or invalid auth credentials are used (e.g. wrong project permissions)
|
76
88
|
def get_upload_token(app_id, binary_path)
|
77
|
-
|
78
|
-
binary_hash = Digest::SHA256.hexdigest(File.open(binary_path).read)
|
79
|
-
rescue Errno::ENOENT
|
89
|
+
if binary_path.nil? || !File.exist?(binary_path)
|
80
90
|
UI.crash!("#{ErrorMessage.binary_not_found(@binary_type)}: #{binary_path}")
|
81
91
|
end
|
92
|
+
binary_hash = Digest::SHA256.hexdigest(File.open(binary_path).read)
|
82
93
|
|
83
94
|
begin
|
84
95
|
response = connection.get(v1_apps_url(app_id)) do |request|
|
85
96
|
request.headers["Authorization"] = "Bearer " + @auth_token
|
86
97
|
end
|
87
98
|
rescue Faraday::ResourceNotFound
|
88
|
-
UI.
|
99
|
+
UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
|
89
100
|
end
|
90
101
|
contact_email = response.body[:contactEmail]
|
91
102
|
if contact_email.nil? || contact_email.strip.empty?
|
92
|
-
UI.
|
103
|
+
UI.user_error!(ErrorMessage::GET_APP_NO_CONTACT_EMAIL_ERROR)
|
93
104
|
end
|
94
105
|
return upload_token_format(response.body[:appId], response.body[:projectNumber], binary_hash)
|
95
106
|
end
|
@@ -132,7 +143,7 @@ module Fastlane
|
|
132
143
|
MAX_POLLING_RETRIES.times do
|
133
144
|
upload_status_response = get_upload_status(app_id, upload_token)
|
134
145
|
if upload_status_response.success? || upload_status_response.already_uploaded?
|
135
|
-
UI.success("Uploaded #{@binary_type}
|
146
|
+
UI.success("Uploaded #{@binary_type} successfully!")
|
136
147
|
break
|
137
148
|
elsif upload_status_response.in_progress?
|
138
149
|
sleep(POLLING_INTERVAL_SECONDS)
|
data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
module ErrorMessage
|
2
2
|
MISSING_CREDENTIALS = "Missing authentication credentials. Check that your Firebase refresh token is set or that your service account file path is correct and try again."
|
3
|
-
MISSING_APP_ID = "Missing app id. Please check that
|
3
|
+
MISSING_APP_ID = "Missing app id. Please check that the app parameter is set and try again"
|
4
4
|
SERVICE_CREDENTIALS_NOT_FOUND = "Service credentials file does not exist. Please check the service credentials path and try again"
|
5
5
|
PARSE_SERVICE_CREDENTIALS_ERROR = "Failed to extract service account information from the service credentials file"
|
6
6
|
UPLOAD_RELEASE_NOTES_ERROR = "App Distribution halted because it had a problem uploading release notes"
|
7
7
|
UPLOAD_TESTERS_ERROR = "App Distribution halted because it had a problem adding testers/groups"
|
8
8
|
GET_RELEASE_TIMEOUT = "App Distribution failed to fetch release information"
|
9
|
-
REFRESH_TOKEN_ERROR = "
|
9
|
+
REFRESH_TOKEN_ERROR = "App Distribution could not generate credentials from the refresh token specified."
|
10
10
|
GET_APP_ERROR = "App Distribution failed to fetch app information"
|
11
11
|
APP_NOT_ONBOARDED_ERROR = "App Distribution not onboarded"
|
12
12
|
GET_APP_NO_CONTACT_EMAIL_ERROR = "App Distribution could not find a contact email associated with this app. Contact Email"
|
13
13
|
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"
|
14
14
|
INVALID_PATH = "Could not read content from"
|
15
|
-
INVALID_TESTERS = "Could not enable access for testers.
|
15
|
+
INVALID_TESTERS = "Could not enable access for testers. Check that the groups exist and the tester emails are formatted correctly"
|
16
16
|
INVALID_RELEASE_ID = "App distribution failed to fetch release with id"
|
17
|
-
SERVICE_CREDENTIALS_ERROR = "
|
17
|
+
SERVICE_CREDENTIALS_ERROR = "App Distribution could not generate credentials from the service credentials file specified. Service Account Path"
|
18
18
|
|
19
19
|
def self.binary_not_found(binary_type)
|
20
20
|
"Could not find the #{binary_type}. Make sure you set the #{binary_type} path parameter to point to your #{binary_type}"
|
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.2.0.pre.
|
4
|
+
version: 0.2.0.pre.3
|
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: 2020-08-
|
13
|
+
date: 2020-08-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pry
|
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: 1.3.1
|
179
179
|
requirements: []
|
180
|
-
rubygems_version: 3.1.
|
180
|
+
rubygems_version: 3.1.2
|
181
181
|
signing_key:
|
182
182
|
specification_version: 4
|
183
183
|
summary: Release your beta builds to Firebase App Distribution. https://firebase.google.com/docs/app-distribution
|