Commit bf08ed62 authored by Vadim Vlasov's avatar Vadim Vlasov

feat: expose AppGate share link via APPGATE_LINK output

Capture the share_url returned by the release creation endpoint and
expose it as ENV['APPGATE_LINK'], lane_context[SharedValues::APPGATE_LINK],
and the action's return value, so later lane steps (e.g. Slack) can
reference the public download page. Warn when older servers omit it.
parent 5a495e0f
module Fastlane module Fastlane
module Actions module Actions
module SharedValues
APPGATE_LINK = :APPGATE_LINK
end
class AppgateUploadAction < Action class AppgateUploadAction < Action
def self.run(params) def self.run(params)
require 'faraday' require 'faraday'
...@@ -34,6 +38,15 @@ module Fastlane ...@@ -34,6 +38,15 @@ module Fastlane
release_id = release_data[:release_id] release_id = release_data[:release_id]
upload_token = release_data[:upload_token] upload_token = release_data[:upload_token]
share_url = release_data[:share_url]
if share_url && !share_url.empty?
ENV["APPGATE_LINK"] = share_url
Actions.lane_context[SharedValues::APPGATE_LINK] = share_url
UI.success("AppGate download page: #{share_url}")
else
UI.important("AppGate did not return a share link (older server?); APPGATE_LINK not set.")
end
uploaded = Helper::AppGateHelper.upload_file_parallel(release_id, file_path, upload_token) uploaded = Helper::AppGateHelper.upload_file_parallel(release_id, file_path, upload_token)
UI.abort_with_message!("Failed to upload file") unless uploaded UI.abort_with_message!("Failed to upload file") unless uploaded
...@@ -49,6 +62,8 @@ module Fastlane ...@@ -49,6 +62,8 @@ module Fastlane
UI.abort_with_message!("Failed to wait for release to be ready") unless release_ready UI.abort_with_message!("Failed to wait for release to be ready") unless release_ready
UI.success("Successfully uploaded and finished release!") UI.success("Successfully uploaded and finished release!")
end end
share_url
end end
##################################################### #####################################################
...@@ -59,6 +74,16 @@ module Fastlane ...@@ -59,6 +74,16 @@ module Fastlane
"Upload build to AppGate" "Upload build to AppGate"
end end
def self.output
[
['APPGATE_LINK', 'Public download/install page URL for the uploaded build']
]
end
def self.return_value
"The public download/install page URL. Also exposed as ENV['APPGATE_LINK'] and lane_context[SharedValues::APPGATE_LINK] for use in later lane steps (e.g. posting to Slack)."
end
def self.available_options def self.available_options
[ [
FastlaneCore::ConfigItem.new(key: :app_id, FastlaneCore::ConfigItem.new(key: :app_id,
......
...@@ -33,7 +33,14 @@ module Fastlane ...@@ -33,7 +33,14 @@ module Fastlane
body[:build_number] = build_number if build_number && !build_number.empty? body[:build_number] = build_number if build_number && !build_number.empty?
response = self.request_with_retry(:post, url, api_key, body) response = self.request_with_retry(:post, url, api_key, body)
return { release_id: response['release_id'], upload_token: response['upload_token'] } if response && response['release_id'] && response['upload_token'] if response && response['release_id'] && response['upload_token']
return {
release_id: response['release_id'],
upload_token: response['upload_token'],
share_url: response['share_url'],
share_token: response['share_token']
}
end
nil nil
end end
......
module Fastlane module Fastlane
module Furylion module Furylion
VERSION = "1.3.1" VERSION = "1.3.2"
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment