Class: Fastlane::Actions::DeploygateAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/deploygate.rb

Constant Summary collapse

DEPLOYGATE_URL_BASE =
'https://deploygate.com'

Class Method Summary collapse

Methods inherited from Fastlane::Action

details, sh

Class Method Details

.authorObject



108
109
110
# File 'lib/fastlane/actions/deploygate.rb', line 108

def self.author
  "tnj"
end

.available_optionsObject



91
92
93
94
95
96
97
98
# File 'lib/fastlane/actions/deploygate.rb', line 91

def self.available_options
  [
    ['api_token', 'DeployGate API Token'],
    ['user', 'Target username or organization name'],
    ['ipa', 'Path to your IPA file. Defaults to output of xcodebuild and ipa'],
    ['message', 'Text for the uploaded build']
  ]
end

.descriptionObject



87
88
89
# File 'lib/fastlane/actions/deploygate.rb', line 87

def self.description
  "Upload a new build to DeployGate"
end

.outputObject



100
101
102
103
104
105
106
# File 'lib/fastlane/actions/deploygate.rb', line 100

def self.output
  [
    ['DEPLOYGATE_URL', 'URL of the newly uploaded build'],
    ['DEPLOYGATE_REVISION', 'auto incremented revision number'],
    ['DEPLOYGATE_APP_INFO', 'Contains app revision, bundle identifier, etc.']
  ]
end

.run(params) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fastlane/actions/deploygate.rb', line 16

def self.run(params)
  require 'shenzhen'
  require 'shenzhen/plugins/deploygate'

  # Available options: https://deploygate.com/docs/api
  options = {
    ipa: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
  }.merge(params.first || {})
  assert_options!(options)

  Helper.log.info 'Starting with ipa upload to DeployGate... this could take some time ⏳'.green
  client = Shenzhen::Plugins::DeployGate::Client.new(
    options.delete(:api_token),
    options.delete(:user)
  )

  return if Helper.test?

  response = client.upload_build(options.delete(:ipa), options)
  if parse_response(response)
    Helper.log.info "DeployGate URL: #{Actions.lane_context[SharedValues::DEPLOYGATE_URL]}"
    Helper.log.info "Build successfully uploaded to DeployGate as revision \##{Actions.lane_context[SharedValues::DEPLOYGATE_REVISION]}!".green
  else
    raise 'Error when trying to upload ipa to DeployGate'.red
  end
end