Commit bcc50713 authored by Vadim Vlasov's avatar Vadim Vlasov

Added branch to appgate_upload

parent f0a2fb48
...@@ -4,7 +4,9 @@ module Fastlane ...@@ -4,7 +4,9 @@ module Fastlane
def self.run(params) def self.run(params)
app_id = params[:app_id] app_id = params[:app_id]
file_path = params[:file_path] file_path = params[:file_path]
branch = params[:branch]
api_key = "bearer " + params[:api_key] api_key = "bearer " + params[:api_key]
include_branch = params[:include_branch]
url = "https://apps.furylion.net/api/app/#{app_id}/upload" url = "https://apps.furylion.net/api/app/#{app_id}/upload"
...@@ -15,7 +17,10 @@ module Fastlane ...@@ -15,7 +17,10 @@ module Fastlane
faraday.adapter Faraday.default_adapter faraday.adapter Faraday.default_adapter
end end
payload = { file: Faraday::UploadIO.new(file_path, 'application/octet-stream') } payload = {
file: Faraday::UploadIO.new(file_path, 'application/octet-stream')
}
payload[:branch] = branch if include_branch
response = conn.post do |req| response = conn.post do |req|
req.headers['Authorization'] = api_key req.headers['Authorization'] = api_key
...@@ -55,6 +60,17 @@ module Fastlane ...@@ -55,6 +60,17 @@ module Fastlane
verify_block: proc do |value| verify_block: proc do |value|
UI.user_error!("Could not find file at path '#{value}'") unless File.exist?(value) UI.user_error!("Could not find file at path '#{value}'") unless File.exist?(value)
end), end),
FastlaneCore::ConfigItem.new(key: :branch,
env_name: "CI_COMMIT_BRANCH",
description: "Branch from which the app is built",
optional: true,
default_value: ""),
FastlaneCore::ConfigItem.new(key: :include_branch,
env_name: "APPGATE_INCLUDE_BRANCH",
description: "Flag to include branch in the upload",
optional: true,
default_value: true,
type: Boolean),
FastlaneCore::ConfigItem.new(key: :api_key, FastlaneCore::ConfigItem.new(key: :api_key,
env_name: "APPGATE_API_KEY", env_name: "APPGATE_API_KEY",
description: "API key for AppGate", description: "API key for AppGate",
......
module Fastlane module Fastlane
module Furylion module Furylion
VERSION = "1.1.7" VERSION = "1.1.8"
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