fastlane-plugin-zealot 0.1.0 → 0.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e53f65df107be1d1cd79b0cf84f2841791357c7e6efecbdd59399b899976ddde
4
- data.tar.gz: 586e7f0e8821806b988a20e0aa348407ce31ffaa4c816ff0ccf8abc91c3f630b
3
+ metadata.gz: 264233b0c85829d6ca9f3ca44b10ac52034e746b06551d6ae3aeca63c831d906
4
+ data.tar.gz: 930c4c1af6719fad749f079a931ecf8b84b4764811802a5c08eba8634a4a40d6
5
5
  SHA512:
6
- metadata.gz: 1bf42c92ab17668d7f1186a97239aa846684b6f2b4348d779e8b8c55b34c93f101835c269126836001ea05e65657eeda7292f57636795533d48d37fccbc7e65e
7
- data.tar.gz: 6fbb5b8cca9ff25e47672980293d900b77a33d4b1a997ab8bd49a0a03638dd3fc568f61c1d50a1393d5ddd6edd129bc5cd31babde6fec73e18d69c62677799f5
6
+ metadata.gz: '041509054ac5119b97e271fd1910163d567eeb49b029a5b93bf8bc6ec777e32503b34fee1cb872498db282c3e0294fe200a01a164267b52c6227560529166cee'
7
+ data.tar.gz: c8f1c527d2e7272567f1fbcc10ddd21e7e0e5d9dcfaf85f79a30372ad96279eea947708c42437b317d06adfb98178b28417db0410ca305140888af8ea698f81f
@@ -109,6 +109,7 @@ module Fastlane
109
109
  env_name: 'ZEALOT_GIT_COMMIT',
110
110
  description: 'The hash of git commit',
111
111
  optional: true,
112
+ default_value: ENV['GIT_COMMIT'] || ENV['CI_COMMIT_SHA'],
112
113
  type: String),
113
114
  FastlaneCore::ConfigItem.new(key: :password,
114
115
  env_name: 'ZEALOT_PASSWORD',
@@ -2,49 +2,63 @@
2
2
 
3
3
  require 'fastlane/action'
4
4
  require_relative '../helper/zealot_helper'
5
- # require 'fastlane-plugin-debug_file'
5
+ require 'fastlane/plugin/debug_file'
6
6
 
7
7
  module Fastlane
8
8
  module Actions
9
9
  class ZealotDebugFileAction < Action
10
10
  extend Fastlane::Helper::ZealotHelper
11
11
 
12
- PLATFORM = %I[ios mac android].freeze
12
+ PLATFORM = %I[ios mac macos osx android].freeze
13
13
 
14
14
  def self.run(params)
15
- endpoint = params[:endpoint]
16
- platform = params[:platform]
17
- path = params[:path]
18
- fail_on_error = params[:fail_on_error]
15
+ file = generate_zip_file(params)
16
+ UI.user_error! "Something wrong with compress debug file" unless file
19
17
 
20
- # UI.user_error! "Not found path: #{path}" unless Dir.exist?(path)
18
+ response = upload_debug_file(params, file)
19
+ if parse_response(response, params[:endpoint], params[:fail_on_error])
20
+ UI.success('Build successfully uploaded to Zealot.')
21
+ # UI.success("Release URL: #{Actions.lane_context[SharedValues::ZEALOT_RELEASE_URL]}")
22
+ # UI.success("QRCode URL: #{Actions.lane_context[SharedValues::ZEALOT_QRCODE_URL]}")
23
+ # UI.success("Download URL: #{Actions.lane_context[SharedValues::ZEALOT_INSTALL_URL]}")
24
+ end
25
+ end
26
+
27
+ def self.generate_zip_file(params)
28
+ new_params = params.all_keys.each_with_object({}) do |key, obj|
29
+ next unless value = params[key]
30
+ obj[key] = value
31
+ end
32
+ path = new_params.delete(:path)
33
+ platform = new_params[:platform]
21
34
 
22
35
  case platform
23
- when :ios, :mac
24
- params.set(archive_path, path) unless path.empty?
25
- file = Fastlane::Actions::DsymAction.run(params)
36
+ when :ios, :mac, :macos, :osx
37
+ generate_dsym_zip(new_params, path)
26
38
  when :android
27
- params.set(app_path, path) unless path.empty?
28
- file = Fastlane::Actions::ProguardAction.run(params)
39
+ generate_proguard_zip(new_params, path)
29
40
  else
30
41
  UI.user_error!("No match value of platform: #{value}, avaiable value are #{PLATFORM.join(',')}.")
31
42
  end
32
-
33
- UI.user_error! "Something wrong with compress debug file" unless file
34
43
  end
35
44
 
36
- def self.upload(upload_url, form, timeout, fail_on_error)
37
- begin
38
- connection.post do |req|
39
- req.url('/api/debug_files/upload')
40
- req.options.timeout = timeout
41
- req.body = form
42
- end
43
- rescue Faraday::Error::TimeoutError
44
- show_error('Uploading build to Zealot timed out ⏳', fail_on_error)
45
+ def self.generate_dsym_zip(params, path)
46
+ params[:archive_path] = if path
47
+ path
48
+ else
49
+ Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE] || Fastlane::Actions::DsymAction::ARCHIVE_PATH
45
50
  end
51
+
52
+ params[:scheme] = params.delete(:xcode_scheme)
53
+ Fastlane::Actions::DsymAction.run(params)
54
+ end
55
+
56
+ def self.generate_proguard_zip(params, path)
57
+ params[:app_path] = path if path && !path.empty?
58
+ params[:build_type] = params.delete(:android_build_type)
59
+ params[:flavor] = params.delete(:android_flavor)
60
+ Fastlane::Actions::ProguardAction.run(params)
46
61
  end
47
- private_class_method :upload
48
62
 
49
63
  def self.parse_response(response, upload_url, fail_on_error)
50
64
  return show_error("Error uploading to Zealot: empty response", fail_on_error) unless response
@@ -55,9 +69,9 @@ module Fastlane
55
69
  return show_error("Error uploading to Zealot: #{response.body}", fail_on_error)
56
70
  end
57
71
 
58
- Actions.lane_context[SharedValues::ZEALOT_RELEASE_URL] = body['release_url']
59
- Actions.lane_context[SharedValues::ZEALOT_INSTALL_URL] = body['install_url']
60
- Actions.lane_context[SharedValues::ZEALOT_QRCODE_URL] = body['qrcode_url']
72
+ # Actions.lane_context[SharedValues::ZEALOT_RELEASE_URL] = body['release_url']
73
+ # Actions.lane_context[SharedValues::ZEALOT_INSTALL_URL] = body['install_url']
74
+ # Actions.lane_context[SharedValues::ZEALOT_QRCODE_URL] = body['qrcode_url']
61
75
 
62
76
  true
63
77
  end
@@ -99,6 +113,7 @@ module Fastlane
99
113
  FastlaneCore::ConfigItem.new(key: :path,
100
114
  env_name: 'ZEALOT_PATH',
101
115
  description: 'The path of debug file (iOS/macOS is archive path for Xcode, Android is path for app project)',
116
+ optional: true,
102
117
  type: String),
103
118
  FastlaneCore::ConfigItem.new(key: :xcode_scheme,
104
119
  env_name: 'ZEALOT_XCODE_SCHEME',
@@ -125,7 +140,7 @@ module Fastlane
125
140
  FastlaneCore::ConfigItem.new(key: :output_path,
126
141
  env_name: 'DF_DSYM_OUTPUT_PATH',
127
142
  description: "The output path of compressed dSYM file",
128
- default_value: OUTPUT_PATH,
143
+ default_value: '.',
129
144
  optional: true,
130
145
  type: String),
131
146
  FastlaneCore::ConfigItem.new(key: :release_version,
@@ -138,11 +153,22 @@ module Fastlane
138
153
  description: 'The build version of app',
139
154
  optional: true,
140
155
  type: String),
156
+ FastlaneCore::ConfigItem.new(key: :overwrite,
157
+ env_name: 'DF_DSYM_OVERWRITE',
158
+ description: "Overwrite output compressed file if it existed",
159
+ default_value: false,
160
+ type: Boolean),
141
161
  FastlaneCore::ConfigItem.new(key: :timeout,
142
162
  env_name: 'ZEALOT_TIMEOUT',
143
163
  description: 'Request timeout in seconds',
144
164
  type: Integer,
145
165
  optional: true),
166
+ FastlaneCore::ConfigItem.new(key: :verify_ssl,
167
+ env_name: 'ZEALOT_VERIFY_SSL',
168
+ description: 'Should verify SSL of zealot service',
169
+ optional: true,
170
+ default_value: true,
171
+ type: Boolean),
146
172
  FastlaneCore::ConfigItem.new(key: :fail_on_error,
147
173
  env_name: 'ZEALOT_FAIL_ON_ERROR',
148
174
  description: 'Should an error uploading app cause a failure? (true/false)',
@@ -7,8 +7,41 @@ module Fastlane
7
7
 
8
8
  module Helper
9
9
  module ZealotHelper
10
+ def upload_debug_file(params, file)
11
+ form = upload_debug_file_params(params, file)
12
+ print_table(form, title: 'zealot_debug_file')
13
+
14
+ endpoint = params[:endpoint]
15
+ UI.success("Uploading to #{endpoint} ...")
16
+ connection = make_connection(params[:endpoint], params[:verify_ssl])
17
+ begin
18
+ connection.post do |req|
19
+ req.url('/api/debug_files/upload')
20
+ req.options.timeout = params[:timeout]
21
+ req.body = form
22
+ end
23
+ rescue Faraday::Error::TimeoutError
24
+ show_error('Uploading build to Zealot timed out ⏳', params[:fail_on_error])
25
+ end
26
+ end
27
+
28
+ def upload_debug_file_params(params, file)
29
+ {
30
+ token: params[:token],
31
+ channel_key: params[:channel_key],
32
+ release_version: params[:release_version],
33
+ build_version: params[:build_version],
34
+ file: Faraday::UploadIO.new(file, 'application/octet-stream')
35
+ }
36
+ end
37
+
38
+ #######################################
39
+
10
40
  def upload_app(params)
11
41
  form = upload_app_params(params)
42
+ # recommand generate collect changelog plugin: https://github.com/icyleaf/fastlane-plugin-ci_changelog
43
+ form[:changelog] = changelog_raw if changelog_raw = ENV['CICL_CHANGLOG']
44
+
12
45
  print_table(form, title: 'zealot', hidden_keys: [:token])
13
46
 
14
47
  endpoint = params[:endpoint]
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Zealot
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0.beta1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-zealot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-11 00:00:00.000000000 Z
11
+ date: 2020-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fastlane-plugin-debug_file
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: pry
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -165,11 +179,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
179
  version: '0'
166
180
  required_rubygems_version: !ruby/object:Gem::Requirement
167
181
  requirements:
168
- - - ">="
182
+ - - ">"
169
183
  - !ruby/object:Gem::Version
170
- version: '0'
184
+ version: 1.3.1
171
185
  requirements: []
172
- rubygems_version: 3.0.6
186
+ rubygems_version: 3.0.3
173
187
  signing_key:
174
188
  specification_version: 4
175
189
  summary: Upload a new build to Zealot