fastlane-plugin-fastci 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76aa3571beeba986621e0cbff3eb16daf5235d7b080708624acd53d3e6afa560
4
- data.tar.gz: 74743848cbf6bfc3919199ec90bc92b1f5b181c8203b51c734f1149e474151f3
3
+ metadata.gz: d1c8c592c87f4597919d8a5534434ed422a94d0560be2ddb2a82353aefe43648
4
+ data.tar.gz: c17fd86d0c3084917668534196fe01053078952f6cdf30e81cf14c50b34dcd2f
5
5
  SHA512:
6
- metadata.gz: 77ba058b10ad7811ba9c78f4d48eaee44bebab88f7709bd8f79186d2fa180a68df438b0bbe2238a8910875a758c2d26af43af41e071f3c8655e629b6cc64e418
7
- data.tar.gz: d834627d814264375a73285bd9e9c23f92e77bded00f1158a9843f5a3216ce1c7f643b55f84460c004c43a3915d8a67a09121f979402f79995a95470adfc081e
6
+ metadata.gz: 6cee5ced946a258e71e30e8c7c7a445e6182ecc61aee1e1cf8a524486ec64a96c8b71eec99f259d58502296c4813c03ad915b6e8ae8b69519e85840306793f77
7
+ data.tar.gz: ef562edaf613408355e8752fe5104948c5f39b2ea156ce241fd57cacefa36503e5199c6dd21b7afeac2edd8202531c9998bd00f05328ac0b766f02a25228a0ae
data/README.md CHANGED
@@ -71,7 +71,8 @@ package(
71
71
  is_detect_unused_code: false, # 是否检测未使用代码
72
72
  is_detect_unused_image: false, # 是否检测未使用图片
73
73
  changelog: options[:changelog], # fir 更新日志
74
- release_notes: options[:release_notes] # 配合 jenkins 传参上传 appstore 格式为 { \"zh-Hans\": \"修复问题\", \"en-US\": \"bugfix\"} JSON 字符串
74
+ release_notes: options[:release_notes], # 配合 jenkins 传参上传 appstore 格式为 { \"zh-Hans\": \"修复问题\", \"en-US\": \"bugfix\"} JSON 字符串
75
+ is_notice_dingding: options[:is_notice_dingding] # 配置钉钉token了,通过该参数控制是否发送通知
75
76
  )
76
77
  ```
77
78
 
@@ -8,38 +8,43 @@ module Fastlane
8
8
  # 打包
9
9
  class PackageAction < Action
10
10
  def self.run(params)
11
-
12
11
  # 入参配置
13
- configuration = params[:configuration] || "Debug"
14
- export_method = params[:export_method] || "development"
12
+ configuration = params[:configuration] || 'Debug'
13
+ export_method = params[:export_method] || 'development'
15
14
  build = params[:build] || nil
16
15
  version = params[:version] || nil
17
16
  is_analyze_swiftlint = params[:is_analyze_swiftlint] || false
18
17
  is_detect_duplicity_code = params[:is_detect_duplicity_code] || false
19
18
  is_detect_unused_code = params[:is_detect_unused_code] || false
20
19
  is_detect_unused_image = params[:is_detect_unused_image] || false
21
- release_notes = params[:release_notes] || ""
22
- if export_method == "app-store" || export_method == "testFlight"
23
- configuration = "Release"
20
+ release_notes = params[:release_notes] || ''
21
+ configuration = 'Release' if %w[app-store testFlight].include?(export_method)
22
+ is_notice_dingding = params[:is_notice_dingding].nil? ? true : params[:is_notice_dingding]
23
+ # 统一发送钉钉消息匿名函数
24
+ send_dingding_notice = lambda do |text|
25
+ if is_notice_dingding
26
+ DingdingHelper.sendMarkdown(text)
27
+ else
28
+ UI.message('*************| 跳过钉钉消息通知(is_notice_dingding=false)|*************')
29
+ end
24
30
  end
25
-
31
+ send_dingding_notice.call('测试一下')
26
32
  # 清理上一次的打包缓存
27
33
  FileUtils.rm_rf(Dir.glob("#{Constants.BUILD_LOG_DIR}/*"))
28
34
  FileUtils.rm_rf(Dir.glob("#{Constants.IPA_OUTPUT_DIR}/*"))
29
-
30
- # 安装证书
31
- other_action.install_certificate()
32
- # 安装 provisioningProfile
33
- other_action.install_profile()
35
+
36
+ # 非自动更新模式下,安装证书和 provisioningProfile
37
+ unless Environment.is_auto_update_provisioning
38
+ other_action.install_certificate
39
+ other_action.install_profile
40
+ end
34
41
 
35
42
  scheme = params[:scheme] || Environment.scheme
36
43
 
37
44
  # 更改项目version
38
45
  if CommonHelper.is_validate_string(version)
39
46
  increment_options = { version_number: version }
40
- if CommonHelper.is_validate_string(Environment.project)
41
- increment_options[:xcodeproj] = Environment.project
42
- end
47
+ increment_options[:xcodeproj] = Environment.project if CommonHelper.is_validate_string(Environment.project)
43
48
  other_action.increment_version_number(increment_options)
44
49
  end
45
50
 
@@ -47,45 +52,43 @@ module Fastlane
47
52
  other_action.update_build_number(
48
53
  build: build
49
54
  )
50
- time = Time.new.strftime("%Y%m%d%H%M")
51
-
55
+ time = Time.new.strftime('%Y%m%d%H%M')
56
+
52
57
  # 获取版本号
53
58
  version_options = { target: scheme }
54
- if CommonHelper.is_validate_string(Environment.project)
55
- version_options[:xcodeproj] = Environment.project
56
- end
59
+ version_options[:xcodeproj] = Environment.project if CommonHelper.is_validate_string(Environment.project)
57
60
  version = other_action.get_version_number(version_options)
58
-
61
+
59
62
  # 获取 build 号
60
63
  build_options = {}
61
- if CommonHelper.is_validate_string(Environment.project)
62
- build_options[:xcodeproj] = Environment.project
63
- end
64
+ build_options[:xcodeproj] = Environment.project if CommonHelper.is_validate_string(Environment.project)
64
65
  build = other_action.get_build_number(build_options)
65
66
  # 生成ipa包的名字格式
66
67
  ipaName = "#{scheme}_#{export_method}_#{version}_#{build}.ipa"
67
-
68
+
68
69
  # 获取 Extension 的 Bundle ID(可能有多个,用逗号分隔)
69
70
  extension_bundle_ids = Environment.extension_bundle_ids
70
71
  extension_profile_names = []
71
72
  # profile 名字
72
- profile_name = ""
73
+ profile_name = ''
73
74
 
74
75
  case export_method
75
- when "development"
76
+ when 'development'
76
77
  profile_name = Environment.provisioningProfiles_development
77
78
  extension_profile_names = Environment.extension_profiles_development
78
- when "ad-hoc"
79
+ when 'ad-hoc'
79
80
  profile_name = Environment.provisioningProfiles_adhoc
80
81
  extension_profile_names = Environment.extension_profiles_adhoc
81
- when "app-store", "testFlight"
82
+ when 'app-store', 'testFlight'
82
83
  profile_name = Environment.provisioningProfiles_appstore
83
84
  extension_profile_names = Environment.extension_profiles_appstore
84
85
  else
85
86
  raise "Unsupported export method: #{export_method}"
86
87
  end
87
88
 
88
- # 组装 provisioningProfiles
89
+ UI.message('*************| 开始打包 |*************')
90
+
91
+ # 组装 provisioningProfiles
89
92
  provisioningProfiles_map = {
90
93
  "#{Environment.bundleID}" => "#{profile_name}"
91
94
  }
@@ -93,11 +96,9 @@ module Fastlane
93
96
  provisioningProfiles_map[ext_bundle_id.strip] = extension_profile_names[idx]&.strip
94
97
  end
95
98
 
96
- UI.message("*************| 开始打包 |*************")
97
-
98
99
  # 对于 testFlight,使用 app-store 方法
99
- gym_method = export_method == "testFlight" ? "app-store" : export_method
100
-
100
+ gym_method = export_method == 'testFlight' ? 'app-store' : export_method
101
+
101
102
  gym_options = {
102
103
  clean: true,
103
104
  silent: true,
@@ -120,11 +121,11 @@ module Fastlane
120
121
 
121
122
  other_action.gym(gym_options)
122
123
 
123
- UI.message("*************| 打包完成 |*************")
124
+ UI.message('*************| 打包完成 |*************')
124
125
 
125
- UI.message("*************| 复制打包产物 |*************")
126
+ UI.message('*************| 复制打包产物 |*************')
126
127
  # 定义桌面路径
127
- desktop_path = File.expand_path("~/Desktop")
128
+ desktop_path = File.expand_path('~/Desktop')
128
129
  output_path = File.join(desktop_path, "BuildOutput_#{scheme}")
129
130
  target_path = File.join(output_path, "#{build}")
130
131
  FileUtils.mkdir_p(target_path)
@@ -140,20 +141,20 @@ module Fastlane
140
141
 
141
142
  ipa_path = "#{Constants.IPA_OUTPUT_DIR}/#{ipaName}"
142
143
 
143
- if gym_method == "app-store"
144
+ if gym_method == 'app-store'
144
145
  notiText = "🚀🚀🚀🚀🚀🚀\n\n#{scheme}-iOS-打包完成\n\n#{version}_#{build}_#{export_method}\n\n🚀🚀🚀🚀🚀🚀"
145
- DingdingHelper.sendMarkdown(notiText)
146
+ send_dingding_notice.call(notiText)
146
147
 
147
148
  if CommonHelper.is_validate_string(Environment.connect_key_id) && CommonHelper.is_validate_string(Environment.connect_issuer_id)
148
149
  # 根据 export_method 决定是否为 TestFlight
149
- is_test_flight = export_method == "testFlight"
150
-
150
+ is_test_flight = export_method == 'testFlight'
151
+
151
152
  other_action.upload_store(
152
153
  release_notes: release_notes,
153
154
  isTestFlight: is_test_flight
154
155
  )
155
156
  notiText = "🚀🚀🚀🚀🚀🚀\n\n#{scheme}-iOS-上传完成\n\n#{version}_#{build}_#{export_method}\n\n🚀🚀🚀🚀🚀🚀"
156
- DingdingHelper.sendMarkdown(notiText)
157
+ send_dingding_notice.call(notiText)
157
158
  end
158
159
  else
159
160
  # 钉钉通知
@@ -161,8 +162,8 @@ module Fastlane
161
162
 
162
163
  # 上传蒲公英
163
164
  if CommonHelper.is_validate_string(Environment.pgy_api_key)
164
- pgy_upload_info = other_action.upload_pgy()
165
- qrCode = pgy_upload_info["buildQRCodeURL"]
165
+ pgy_upload_info = other_action.upload_pgy
166
+ qrCode = pgy_upload_info['buildQRCodeURL']
166
167
 
167
168
  if CommonHelper.is_validate_string(qrCode)
168
169
  notiText << "\n\n⬇️⬇️⬇️ 扫码安装 ⬇️⬇️⬇️\n\n\n密码: #{Environment.pgy_password}\n![screenshot](#{qrCode})"
@@ -181,43 +182,43 @@ module Fastlane
181
182
  end
182
183
  end
183
184
 
184
- DingdingHelper.sendMarkdown(notiText)
185
+ send_dingding_notice.call(notiText)
185
186
  end
186
187
 
187
188
  # Sentry 上传 dSYM
188
- if CommonHelper.is_validate_string(Environment.sentry_auth_token)
189
- other_action.sentry_upload_dsym()
189
+ if CommonHelper.is_validate_string(Environment.sentry_auth_token)
190
+ other_action.sentry_upload_dsym
190
191
  else
191
- UI.message("*************| 未配置 Sentry 跳过 dSYM 上传 |*************")
192
+ UI.message('*************| 未配置 Sentry 跳过 dSYM 上传 |*************')
192
193
  end
193
194
 
194
195
  # 代码分析
195
- if is_analyze_swiftlint && gym_method != "app-store"
196
+ if is_analyze_swiftlint && gym_method != 'app-store'
196
197
  other_action.analyze_swiftlint(
197
198
  is_from_package: true,
198
199
  configuration: configuration
199
200
  )
200
201
  # 结果复制到桌面
201
202
  FileUtils.cp(SWIFTLINT_ANALYZE_HTML_FILE, target_path)
202
- UI.message("*************| 代码分析完成 |*************")
203
+ UI.message('*************| 代码分析完成 |*************')
203
204
  else
204
- UI.message("*************| 跳过代码分析 |*************")
205
+ UI.message('*************| 跳过代码分析 |*************')
205
206
  end
206
207
 
207
208
  # 重复代码检查
208
- if is_detect_duplicity_code && gym_method != "app-store"
209
+ if is_detect_duplicity_code && gym_method != 'app-store'
209
210
  other_action.detect_duplicity_code(
210
211
  is_all: true
211
212
  )
212
213
  # 结果复制到桌面
213
214
  FileUtils.cp(DUPLICITY_CODE_HTML_FILE, target_path)
214
- UI.message("*************| 重复代码检查完成 |*************")
215
+ UI.message('*************| 重复代码检查完成 |*************')
215
216
  else
216
- UI.message("*************| 跳过重复代码检查 |*************")
217
+ UI.message('*************| 跳过重复代码检查 |*************')
217
218
  end
218
219
 
219
220
  # 无用代码检查
220
- if is_detect_unused_code && gym_method != "app-store"
221
+ if is_detect_unused_code && gym_method != 'app-store'
221
222
  other_action.detect_unused_code(
222
223
  scheme: scheme,
223
224
  is_from_package: true,
@@ -225,127 +226,130 @@ module Fastlane
225
226
  )
226
227
  # 结果复制到桌面
227
228
  FileUtils.cp(Constants.UNUSED_CODE_HTML_FILE, target_path)
228
- UI.message("*************| 无用代码检查完成 |*************")
229
+ UI.message('*************| 无用代码检查完成 |*************')
229
230
  else
230
- UI.message("*************| 跳过无用代码检查 |*************")
231
+ UI.message('*************| 跳过无用代码检查 |*************')
231
232
  end
232
233
 
233
234
  # 无用图片检查
234
- if is_detect_unused_image && gym_method != "app-store"
235
- other_action.detect_unused_image()
235
+ if is_detect_unused_image && gym_method != 'app-store'
236
+ other_action.detect_unused_image
236
237
  # 结果复制到桌面
237
238
  FileUtils.cp(Constants.UNUSED_IMAGE_HTML_FILE, target_path)
238
- UI.message("*************| 无用图片检查完成 |*************")
239
+ UI.message('*************| 无用图片检查完成 |*************')
239
240
  else
240
- UI.message("*************| 跳过未使用图片检查 |*************")
241
+ UI.message('*************| 跳过未使用图片检查 |*************')
241
242
  end
242
243
 
243
244
  if is_analyze_swiftlint ||
244
- is_detect_duplicity_code ||
245
- is_detect_unused_code ||
246
- is_detect_unused_image
245
+ is_detect_duplicity_code ||
246
+ is_detect_unused_code ||
247
+ is_detect_unused_image
247
248
  # 钉钉通知
248
249
  notiText = "🚀🚀🚀🚀🚀🚀\n\n#{scheme}-iOS-代码检查完成\n\n#{version}_#{build}_#{export_method}\n\n🚀🚀🚀🚀🚀🚀"
249
- DingdingHelper.sendMarkdown(notiText)
250
+ send_dingding_notice.call(notiText)
250
251
  else
251
- UI.message("*************| 跳过代码检查 |*************")
252
+ UI.message('*************| 跳过代码检查 |*************')
252
253
  end
253
254
 
254
- UI.message("*************| 脚本完成 |*************")
255
+ UI.message('*************| 脚本完成 |*************')
255
256
  end
256
257
 
257
258
  def self.description
258
- "打包"
259
+ '打包'
259
260
  end
260
261
 
261
262
  def self.available_options
262
263
  [
263
264
  FastlaneCore::ConfigItem.new(
264
265
  key: :scheme,
265
- description: "不采取默认配置,自定义 `scheme` 名称",
266
+ description: '不采取默认配置,自定义 `scheme` 名称',
266
267
  optional: true,
267
268
  default_value: nil,
268
269
  type: String
269
270
  ),
270
271
  FastlaneCore::ConfigItem.new(
271
272
  key: :configuration,
272
- description: "编译环境 Release or Debug",
273
+ description: '编译环境 Release or Debug',
273
274
  optional: true,
274
- default_value: "Debug",
275
+ default_value: 'Debug',
275
276
  type: String,
276
277
  verify_block: proc do |value|
277
- valid_params = ["Release", "Debug"]
278
- unless valid_params.include?(value)
279
- UI.user_error!("无效的编译环境: #{value}。支持的环境: #{valid_params.join(', ')}")
280
- end
278
+ valid_params = %w[Release Debug]
279
+ UI.user_error!("无效的编译环境: #{value}。支持的环境: #{valid_params.join(', ')}") unless valid_params.include?(value)
281
280
  end
282
281
  ),
283
282
  FastlaneCore::ConfigItem.new(
284
283
  key: :export_method,
285
- description: "打包方式 ad-hoc, enterprise, app-store, development, testFlight",
284
+ description: '打包方式 ad-hoc, enterprise, app-store, development, testFlight',
286
285
  optional: true,
287
- default_value: "development",
286
+ default_value: 'development',
288
287
  type: String,
289
288
  verify_block: proc do |value|
290
- valid_params = ["ad-hoc", "enterprise", "app-store", "development", "testFlight"]
291
- unless valid_params.include?(value)
292
- UI.user_error!("无效的打包方式: #{value}。支持的方式: #{valid_params.join(', ')}")
293
- end
289
+ valid_params = %w[ad-hoc enterprise app-store development testFlight]
290
+ UI.user_error!("无效的打包方式: #{value}。支持的方式: #{valid_params.join(', ')}") unless valid_params.include?(value)
294
291
  end
295
292
  ),
296
293
  FastlaneCore::ConfigItem.new(
297
294
  key: :version,
298
- description: "自定义 `version`。在 Xcode13 之后创建的项目,不再支持脚本修改。需要兼容请在 Build settings 中将 GENERATE_INFOPLIST_FILE 设置为 NO",
295
+ description: '自定义 `version`。在 Xcode13 之后创建的项目,不再支持脚本修改。需要兼容请在 Build settings 中将 GENERATE_INFOPLIST_FILE 设置为 NO',
299
296
  optional: true,
300
297
  default_value: nil,
301
298
  type: String
302
299
  ),
303
300
  FastlaneCore::ConfigItem.new(
304
301
  key: :build,
305
- description: "不采取自动更新,自定义 `build` 号",
302
+ description: '不采取自动更新,自定义 `build` 号',
306
303
  optional: true,
307
304
  default_value: nil,
308
305
  type: String
309
306
  ),
310
307
  FastlaneCore::ConfigItem.new(
311
308
  key: :is_analyze_swiftlint,
312
- description: "是否代码分析",
309
+ description: '是否代码分析',
313
310
  optional: true,
314
311
  default_value: false,
315
312
  type: Boolean
316
313
  ),
317
314
  FastlaneCore::ConfigItem.new(
318
315
  key: :is_detect_duplicity_code,
319
- description: "是否检查重复代码",
316
+ description: '是否检查重复代码',
320
317
  optional: true,
321
318
  default_value: false,
322
319
  type: Boolean
323
320
  ),
324
321
  FastlaneCore::ConfigItem.new(
325
322
  key: :is_detect_unused_code,
326
- description: "是否检查无用代码",
323
+ description: '是否检查无用代码',
327
324
  optional: true,
328
325
  default_value: false,
329
326
  type: Boolean
330
327
  ),
331
328
  FastlaneCore::ConfigItem.new(
332
329
  key: :is_detect_unused_image,
333
- description: "是否检查无用图片",
330
+ description: '是否检查无用图片',
334
331
  optional: true,
335
332
  default_value: false,
336
333
  type: Boolean
337
334
  ),
338
335
  FastlaneCore::ConfigItem.new(
339
336
  key: :changelog,
340
- description: "更新日志",
337
+ description: '更新日志',
341
338
  optional: true,
342
339
  type: String
343
340
  ),
344
341
  FastlaneCore::ConfigItem.new(
345
342
  key: :release_notes,
346
- description: "更新文案, 格式为 { \"zh-Hans\": \"修复问题\", \"en-US\": \"bugfix\"} JSON 字符串",
343
+ description: '更新文案, 格式为 { "zh-Hans": "修复问题", "en-US": "bugfix"} JSON 字符串',
347
344
  optional: true,
348
345
  type: String
346
+ ),
347
+ FastlaneCore::ConfigItem.new(
348
+ key: :is_notice_dingding,
349
+ description: '是否通知钉钉(默认true, 优先级高于DINGDING_TOKEN)',
350
+ optional: true,
351
+ default_value: true,
352
+ type: Boolean
349
353
  )
350
354
  ]
351
355
  end
@@ -357,7 +361,6 @@ module Fastlane
357
361
  def self.category
358
362
  :building
359
363
  end
360
-
361
364
  end
362
365
  end
363
- end
366
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Fastci
3
- VERSION = "0.0.19"
3
+ VERSION = "0.0.20"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-fastci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - watermelon
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 1.36.0
60
+ version: 2.5.1
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 1.36.0
67
+ version: 2.5.1
68
68
  email: watermelon_lp@163.com
69
69
  executables: []
70
70
  extensions: []