Skip to content

Commit f836c68

Browse files
authored
Merge pull request #288 from fastlane/add-release-links
Print out release links
2 parents 7157246 + 16fbcaa commit f836c68

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def self.run(params)
4646

4747
upload_timeout = get_upload_timeout(params)
4848

49-
release_name = fad_api_client.upload(app_name, binary_path, platform.to_s, upload_timeout)
49+
upload_status_response = fad_api_client.upload(app_name, binary_path, platform.to_s, upload_timeout)
50+
release_name = upload_status_response.release_name
5051

5152
if binary_type == :AAB && aab_info && !aab_info.certs_provided?
5253
updated_aab_info = fad_api_client.get_aab_info(app_name)
@@ -69,6 +70,18 @@ def self.run(params)
6970
group_aliases = string_to_array(groups)
7071
fad_api_client.distribute(release_name, emails, group_aliases)
7172
UI.success("🎉 App Distribution upload finished successfully.")
73+
74+
if upload_status_response.firebase_console_uri
75+
UI.message("🔗 View this release in the Firebase console: #{upload_status_response.firebase_console_uri}")
76+
end
77+
78+
if upload_status_response.testing_uri
79+
UI.message("🔗 Share this release with testers: #{upload_status_response.testing_uri}")
80+
end
81+
82+
if upload_status_response.binary_download_uri
83+
UI.message("🔗 Download the release binary (link expires in 1 hour): #{upload_status_response.binary_download_uri}")
84+
end
7285
end
7386

7487
def self.description

lib/fastlane/plugin/firebase_app_distribution/client/firebase_app_distribution_api_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def upload(app_name, binary_path, platform, timeout)
171171
UI.crash!("It took longer than expected to process your #{binary_type}, please try again.")
172172
end
173173

174-
upload_status_response.release_name
174+
upload_status_response
175175
end
176176

177177
# Fetches the status of an uploaded binary

lib/fastlane/plugin/firebase_app_distribution/helper/upload_status_response.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ def release_version
3131
end
3232
end
3333

34+
def firebase_console_uri
35+
release ? release[:firebaseConsoleUri] : nil
36+
end
37+
38+
def testing_uri
39+
release ? release[:testingUri] : nil
40+
end
41+
42+
def binary_download_uri
43+
release ? release[:binaryDownloadUri] : nil
44+
end
45+
3446
def status
3547
response ? response[:result] : nil
3648
end

spec/firebase_app_distribution_api_client_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
stub_const("Fastlane::Client::FirebaseAppDistributionApiClient::POLLING_INTERVAL_SECONDS", 0)
185185
end
186186

187-
it 'uploads the app binary then returns the release name' do
187+
it 'uploads the app binary then returns the upload response' do
188188
expect(api_client).to receive(:upload_binary)
189189
.with(app_name, fake_binary_path, "android", upload_timeout)
190190
.and_return(operation_name)
@@ -199,7 +199,7 @@
199199
.at_most(:once)
200200

201201
result = api_client.upload(app_name, fake_binary_path, "android", upload_timeout)
202-
expect(result).to eq(release_name)
202+
expect(result).to eq(upload_status_response_success)
203203
end
204204

205205
it 'uploads the app binary for an existing unmodified binary' do
@@ -217,7 +217,7 @@
217217
.at_most(:once)
218218

219219
result = api_client.upload(app_name, fake_binary_path, "android", upload_timeout)
220-
expect(result).to eq(release_name)
220+
expect(result).to eq(upload_status_response_release_unmodified)
221221
end
222222

223223
it 'uploads the app binary for an existing updated binary' do
@@ -235,7 +235,7 @@
235235
.at_most(:once)
236236

237237
result = api_client.upload(app_name, fake_binary_path, "android", upload_timeout)
238-
expect(result).to eq(release_name)
238+
expect(result).to eq(upload_status_response_release_updated)
239239
end
240240

241241
it 'raises an error after polling MAX_POLLING_RETRIES times' do
@@ -273,7 +273,7 @@
273273
.and_return(upload_status_response_success)
274274

275275
result = api_client.upload(app_name, fake_binary_path, "android", upload_timeout)
276-
expect(result).to eq(release_name)
276+
expect(result).to eq(upload_status_response_success)
277277
end
278278

279279
it 'crashes after failing to upload with status error' do

0 commit comments

Comments
 (0)