Method: Fastlane::Actions::DeploygateAction.run

Defined in:
fastlane/lib/fastlane/actions/deploygate.rb

.run(options) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'fastlane/lib/fastlane/actions/deploygate.rb', line 40

def self.run(options)
  # Available options: https://deploygate.com/docs/api
  UI.success('Starting with app upload to DeployGate... this could take some time ⏳')

  api_token = options[:api_token]
  user_name = options[:user]
  binary = options[:ipa] || options[:apk]
  upload_options = options.values.select do |key, _|
    [:message, :distribution_key, :release_note, :disable_notify, :distribution_name].include?(key)
  end

  UI.user_error!('missing `ipa` and `apk`. deploygate action needs least one.') unless binary

  return binary if Helper.test?

  response = self.upload_build(api_token, user_name, binary, upload_options)
  if parse_response(response)
    UI.message("DeployGate URL: #{Actions.lane_context[SharedValues::DEPLOYGATE_URL]}")
    UI.success("Build successfully uploaded to DeployGate as revision \##{Actions.lane_context[SharedValues::DEPLOYGATE_REVISION]}!")
  else
    UI.user_error!("Error when trying to upload app to DeployGate")
  end
end