fastlane-plugin-firebase_app_distribution 0.2.3 → 0.2.4
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 +1 -1
- data/lib/fastlane/plugin/firebase_app_distribution/client/error_response.rb +16 -0
- data/lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb +20 -10
- data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb +1 -0
- data/lib/fastlane/plugin/firebase_app_distribution/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a6b59efacf7524b9c562405bf867140a83ece4972cc0e4c22cfea123e1e5842
|
4
|
+
data.tar.gz: 1a64bbb493f3956eb5d90e78ffbbc6ffa60ceb54930542f6cbcefcf179cc9820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be9c94c149bd843bdad4523c559c84fee46813b97e9c02a383a18824d23e8f5c61db0c66209f1673d4c879fcf22a0714e49c98dd8b960554219b59c8289c2c53
|
7
|
+
data.tar.gz: 4cd7cb1a546b6baa8fa11a8829e45b488bfaf3c54934cc016c161914f03321611ba25e8b6116c77029c9d5d9a4851ce548a01d60ad719ddd06e13413190e191e
|
data/lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb
CHANGED
@@ -26,7 +26,7 @@ module Fastlane
|
|
26
26
|
binary_path = binary_path_from_platform(platform, params[:ipa_path], params[:apk_path])
|
27
27
|
|
28
28
|
auth_token = fetch_auth_token(params[:service_credentials_file], params[:firebase_cli_token])
|
29
|
-
fad_api_client = Client::FirebaseAppDistributionApiClient.new(auth_token, platform)
|
29
|
+
fad_api_client = Client::FirebaseAppDistributionApiClient.new(auth_token, platform, params[:debug])
|
30
30
|
|
31
31
|
release_id = fad_api_client.upload(app_id, binary_path, platform.to_s)
|
32
32
|
if release_id.nil?
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Client
|
3
|
+
class ErrorResponse
|
4
|
+
attr_accessor :code, :message, :status
|
5
|
+
|
6
|
+
def initialize(response)
|
7
|
+
unless response[:body].nil? || response[:body].empty?
|
8
|
+
response_body = JSON.parse(response[:body], symbolize_names: true)
|
9
|
+
@code = response_body[:error][:code]
|
10
|
+
@message = response_body[:error][:message]
|
11
|
+
@status = response_body[:error][:status]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fastlane_core/ui/ui'
|
2
2
|
require_relative '../actions/firebase_app_distribution_login'
|
3
|
+
require_relative '../client/error_response'
|
3
4
|
|
4
5
|
module Fastlane
|
5
6
|
module Client
|
@@ -9,8 +10,14 @@ module Fastlane
|
|
9
10
|
MAX_POLLING_RETRIES = 60
|
10
11
|
POLLING_INTERVAL_SECONDS = 2
|
11
12
|
|
12
|
-
|
13
|
+
AUTHORIZATION = "Authorization"
|
14
|
+
CONTENT_TYPE = "Content-Type"
|
15
|
+
APPLICATION_JSON = "application/json"
|
16
|
+
APPLICATION_OCTET_STREAM = "application/octet-stream"
|
17
|
+
|
18
|
+
def initialize(auth_token, platform, debug = false)
|
13
19
|
@auth_token = auth_token
|
20
|
+
@debug = debug
|
14
21
|
|
15
22
|
if platform.nil?
|
16
23
|
@binary_type = "IPA/APK"
|
@@ -39,8 +46,8 @@ module Fastlane
|
|
39
46
|
payload = { emails: emails, groupIds: group_ids }
|
40
47
|
begin
|
41
48
|
connection.post(enable_access_url(app_id, release_id), payload.to_json) do |request|
|
42
|
-
request.headers[
|
43
|
-
request.headers[
|
49
|
+
request.headers[AUTHORIZATION] = "Bearer " + @auth_token
|
50
|
+
request.headers[CONTENT_TYPE] = APPLICATION_JSON
|
44
51
|
end
|
45
52
|
rescue Faraday::ResourceNotFound
|
46
53
|
UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
|
@@ -67,13 +74,14 @@ module Fastlane
|
|
67
74
|
end
|
68
75
|
begin
|
69
76
|
connection.post(release_notes_create_url(app_id, release_id), payload.to_json) do |request|
|
70
|
-
request.headers[
|
71
|
-
request.headers[
|
77
|
+
request.headers[AUTHORIZATION] = "Bearer " + @auth_token
|
78
|
+
request.headers[CONTENT_TYPE] = APPLICATION_JSON
|
72
79
|
end
|
73
80
|
rescue Faraday::ResourceNotFound
|
74
81
|
UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
|
75
|
-
|
76
|
-
|
82
|
+
rescue Faraday::ClientError => e
|
83
|
+
error = ErrorResponse.new(e.response)
|
84
|
+
UI.user_error!("#{ErrorMessage::INVALID_RELEASE_NOTES}: #{error.message}")
|
77
85
|
end
|
78
86
|
UI.success("✅ Posted release notes.")
|
79
87
|
end
|
@@ -95,7 +103,7 @@ module Fastlane
|
|
95
103
|
|
96
104
|
begin
|
97
105
|
response = connection.get(v1_apps_url(app_id)) do |request|
|
98
|
-
request.headers[
|
106
|
+
request.headers[AUTHORIZATION] = "Bearer " + @auth_token
|
99
107
|
end
|
100
108
|
rescue Faraday::ResourceNotFound
|
101
109
|
UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
|
@@ -117,7 +125,8 @@ module Fastlane
|
|
117
125
|
# Throws a user_error if an invalid app id is passed in, or if the binary file does not exist
|
118
126
|
def upload_binary(app_id, binary_path, platform)
|
119
127
|
connection.post(binary_upload_url(app_id), read_binary(binary_path)) do |request|
|
120
|
-
request.headers[
|
128
|
+
request.headers[AUTHORIZATION] = "Bearer " + @auth_token
|
129
|
+
request.headers[CONTENT_TYPE] = APPLICATION_OCTET_STREAM
|
121
130
|
request.headers["X-APP-DISTRO-API-CLIENT-ID"] = "fastlane"
|
122
131
|
request.headers["X-APP-DISTRO-API-CLIENT-TYPE"] = platform
|
123
132
|
request.headers["X-APP-DISTRO-API-CLIENT-VERSION"] = Fastlane::FirebaseAppDistribution::VERSION
|
@@ -184,7 +193,7 @@ module Fastlane
|
|
184
193
|
def get_upload_status(app_id, upload_token)
|
185
194
|
begin
|
186
195
|
response = connection.get(upload_status_url(app_id, upload_token)) do |request|
|
187
|
-
request.headers[
|
196
|
+
request.headers[AUTHORIZATION] = "Bearer " + @auth_token
|
188
197
|
end
|
189
198
|
rescue Faraday::ResourceNotFound
|
190
199
|
UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
|
@@ -222,6 +231,7 @@ module Fastlane
|
|
222
231
|
@connection ||= Faraday.new(url: BASE_URL) do |conn|
|
223
232
|
conn.response(:json, parser_options: { symbolize_names: true })
|
224
233
|
conn.response(:raise_error) # raise_error middleware will run before the json middleware
|
234
|
+
conn.response(:logger, nil, { headers: false, bodies: { response: true }, log_level: :debug }) if @debug
|
225
235
|
conn.adapter(Faraday.default_adapter)
|
226
236
|
end
|
227
237
|
end
|
data/lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb
CHANGED
@@ -14,6 +14,7 @@ module ErrorMessage
|
|
14
14
|
INVALID_PATH = "Could not read content from"
|
15
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
|
+
INVALID_RELEASE_NOTES = "Failed to add release notes"
|
17
18
|
SERVICE_CREDENTIALS_ERROR = "App Distribution could not generate credentials from the service credentials file specified. Service Account Path"
|
18
19
|
|
19
20
|
def self.binary_not_found(binary_type)
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
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.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Natchev
|
8
8
|
- Manny Jimenez
|
9
9
|
- Alonso Salas Infante
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-09
|
13
|
+
date: 2020-10-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pry
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: 2.127.1
|
141
|
-
description:
|
141
|
+
description:
|
142
142
|
email:
|
143
143
|
- snatchev@google.com
|
144
144
|
- mannyjimenez@google.com
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/fastlane/plugin/firebase_app_distribution.rb
|
153
153
|
- lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb
|
154
154
|
- lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb
|
155
|
+
- lib/fastlane/plugin/firebase_app_distribution/client/error_response.rb
|
155
156
|
- lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb
|
156
157
|
- lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_auth_client.rb
|
157
158
|
- lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_error_message.rb
|
@@ -162,7 +163,7 @@ homepage: https://github.com/fastlane/fastlane-plugin-firebase_app_distribution
|
|
162
163
|
licenses:
|
163
164
|
- MIT
|
164
165
|
metadata: {}
|
165
|
-
post_install_message:
|
166
|
+
post_install_message:
|
166
167
|
rdoc_options: []
|
167
168
|
require_paths:
|
168
169
|
- lib
|
@@ -177,8 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
178
|
- !ruby/object:Gem::Version
|
178
179
|
version: '0'
|
179
180
|
requirements: []
|
180
|
-
rubygems_version: 3.1.
|
181
|
-
signing_key:
|
181
|
+
rubygems_version: 3.1.4
|
182
|
+
signing_key:
|
182
183
|
specification_version: 4
|
183
184
|
summary: Release your beta builds to Firebase App Distribution. https://firebase.google.com/docs/app-distribution
|
184
185
|
test_files: []
|