Class: Fastlane::Actions::ZealotAction

Inherits:
Action
  • Object
show all
Extended by:
Helper::ZealotHelper
Defined in:
lib/fastlane/plugin/zealot/actions/zealot_action.rb

Constant Summary

Constants included from Helper::ZealotHelper

Helper::ZealotHelper::UPLOAD_APP_PARAMS_KEYS

Documentation collapse

Class Method Summary collapse

Methods included from Helper::ZealotHelper

avialable_upload_app_params, build_app_version_check_params, build_table_data, check_app_version, detect_ci_url, detect_source, gitlab?, hidden_keys, http_request, jenkins?, make_connection, print_table, show_error, sync_deivce, upload_app, upload_app_params, upload_debug_file, upload_debug_file_params

Class Method Details

.authorsObject



207
208
209
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 207

def self.authors
  ['icyleaf']
end

.available_optionsObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 64

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :endpoint,
                                 env_name: 'ZEALOT_ENDPOINT',
                                 description: 'The endpoint of zealot',
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :token,
                                 env_name: 'ZEALOT_TOKEN',
                                 description: 'The token of user',
                                 sensitive: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("No user token for Zealot given, pass using `token: 'token'`") if value.nil? || value.empty?
                                 end,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :channel_key,
                                 env_name: 'ZEALOT_CHANNEL_KEY',
                                 description: 'The key of app\'s channel',
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :file,
                                 env_name: 'ZEALOT_FILE',
                                 description: 'The path of app file. Optional if you use the `gym`, `ipa`, `xcodebuild` or `gradle` action. ',
                                 default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Dir['*.ipa'].last || Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] || Dir['*.apk'].last,
                                 verify_block: proc do |value|
                                   UI.user_error!("Couldn't pass empty to file") if value.nil? || value.empty?
                                   UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
                                 end,
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :name,
                                 env_name: 'ZEALOT_NAME',
                                 description: 'The name of app to display on zealot',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :changelog,
                                 env_name: 'ZEALOT_CHANGELOG',
                                 description: 'The changelog of app',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :slug,
                                 env_name: 'ZEALOT_SLUG',
                                 description: 'The slug of app',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :release_type,
                                 env_name: 'ZEALOT_RELEASE_TYPE',
                                 description: 'The release type of app',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :branch,
                                 env_name: 'ZEALOT_BRANCH',
                                 description: 'The name of git branch',
                                 default_value: ENV['GIT_BRANCH'] || ENV['CI_COMMIT_REF_NAME'] || ENV['CI_BUILD_REF_NAME'],
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :git_commit,
                                 env_name: 'ZEALOT_GIT_COMMIT',
                                 description: 'The hash of git commit',
                                 optional: true,
                                 default_value: ENV['GIT_COMMIT'] || ENV['CI_COMMIT_SHA'] || ENV['CI_BUILD_REF'],
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :custom_fields,
                                 env_name: 'ZEALOT_CUSTOM_FIELDS',
                                 description: 'The key-value hash of custom fields',
                                 optional: true,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :password,
                                 env_name: 'ZEALOT_PASSWORD',
                                 description: 'The password of app to download',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :source,
                                 env_name: 'ZEALOT_SOURCE',
                                 description: 'The name of upload source',
                                 optional: true,
                                 default_value: 'fastlane',
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :ci_url,
                                 env_name: 'ZEALOT_CI_CURL',
                                 description: 'The name of upload source',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :timeout,
                                 env_name: 'ZEALOT_TIMEOUT',
                                 description: 'Request timeout in seconds',
                                 type: Integer,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :hide_user_token,
                                 env_name: 'ZEALOT_HIDE_USER_TOKEN',
                                 description: 'replase user token to *** to keep secret',
                                 optional: true,
                                 default_value: true,
                                 type: Boolean),
    FastlaneCore::ConfigItem.new(key: :verify_ssl,
                                 env_name: 'ZEALOT_VERIFY_SSL',
                                 description: 'Should verify SSL of zealot service',
                                 optional: true,
                                 default_value: true,
                                 type: Boolean),
    FastlaneCore::ConfigItem.new(key: :fail_on_error,
                                 env_name: 'ZEALOT_FAIL_ON_ERROR',
                                 description: 'Should an error uploading app cause a failure',
                                 optional: true,
                                 default_value: false,
                                 type: Boolean)
  ]
end

.categoryObject



203
204
205
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 203

def self.category
  :beta
end

.descriptionObject



60
61
62
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 60

def self.description
  'Upload a new build to Zealot'
end

.example_codeObject



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 171

def self.example_code
  [
    'zealot(
      endpoint: "...",
      token: "...",
      channel_key: "..."
    )',
    'zealot(
      endpoint: "...",
      token: "...",
      channel_key: "...",
      name: "custom_app_name",
      release_type: "adhoc",
      branch: "develop",
      git_commit: "8s20an32",
      source: "jenkins",
      file: "./app.{ipa,apk}"
    )',
  ]
end

.is_supported?(_) ⇒ Boolean

Returns:

  • (Boolean)


211
212
213
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 211

def self.is_supported?(_)
  true
end

.outputObject



192
193
194
195
196
197
198
199
200
201
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 192

def self.output
  [
    ['ZEALOT_APP_ID', 'The id of app'],
    ['ZEALOT_RELEASE_ID', 'The id of app\'s release'],
    ['ZEALOT_RELEASE_URL', 'The release URL of the newly uploaded build'],
    ['ZEALOT_INSTALL_URL', 'The install URL of the newly uploaded build'],
    ['ZEALOT_QRCODE_URL', 'The QRCode URL of the newly uploaded build'],
    ['ZEAALOT_ERROR_MESSAGE', 'The error message during upload process'],
  ]
end

.run(params) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fastlane/plugin/zealot/actions/zealot_action.rb', line 20

def self.run(params)
  endpoint = params[:endpoint]
  fail_on_error = params[:fail_on_error]

  response = upload_app(params)
  if parse_response(response, endpoint, fail_on_error)
    UI.success('Build successfully uploaded to Zealot.')
    UI.success("Release URL: #{Actions.lane_context[SharedValues::ZEALOT_RELEASE_URL]}")
    UI.success("QRCode URL: #{Actions.lane_context[SharedValues::ZEALOT_QRCODE_URL]}")
    UI.success("Download URL: #{Actions.lane_context[SharedValues::ZEALOT_INSTALL_URL]}")
  end
end