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

action_name, authors, details, sh, step_text

Class Method Details

.authorObject



119
120
121
# File 'lib/fastlane/actions/deploygate.rb', line 119

def self.author
  "tnj"
end

.available_optionsObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/fastlane/actions/deploygate.rb', line 83

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: "DEPLOYGATE_API_TOKEN",
                                 description: "Deploygate API Token",
                                 verify_block: Proc.new do |value|
                                    raise "No API Token for DeployGate given, pass using `api_token: 'token'`".red unless value.to_s.length > 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :user,
                                 env_name: "DEPLOYGATE_USER",
                                 description: "Target username or organization name", 
                                 verify_block: Proc.new do |value|
                                  raise "No User for app given, pass using `user: 'user'`".red unless value.to_s.length > 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :ipa,
                                 env_name: "DEPLOYGATE_IPA_PATH",
                                 description: "Path to your IPA file. Optional if you use the `ipa` or `xcodebuild` action",
                                 default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
                                 verify_block: Proc.new do |value|
                                  raise "Couldn't find ipa file at path '#{value}'".red unless File.exists?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :message,
                                 env_name: "DEPLOYGATE_MESSAGE",
                                 description: "Release Notes",
                                 default_value: "No changelog provided")
  ]
end

.descriptionObject



79
80
81
# File 'lib/fastlane/actions/deploygate.rb', line 79

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/fastlane/actions/deploygate.rb', line 16

def self.is_supported?(platform)
  platform == :ios
end

.outputObject



111
112
113
114
115
116
117
# File 'lib/fastlane/actions/deploygate.rb', line 111

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(options) ⇒ Object



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 20

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

  # Available options: https://deploygate.com/docs/api
  Helper.log.info 'Starting with ipa upload to DeployGate... this could take some time ⏳'.green

  client = Shenzhen::Plugins::DeployGate::Client.new(
    options[:api_token],
    options[:user]
  )

  return options[:ipa] if Helper.test?

  response = client.upload_build(options[:ipa], options.values)
  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