fastlane-plugin-appcenter 0.2.2 → 1.0.0

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: 4ed345ffa12f5eb4ad5de4a627367908c22be9b9854e77f0a0149e708a4edc9a
4
- data.tar.gz: 6574127a56bf36345e651a65d5ed69c406c4e7edaa68af8db9522afc81c45586
3
+ metadata.gz: 156b2b0f457a0ad05bd0abe5d232e4e960d36190002882545734f8a150e9284c
4
+ data.tar.gz: bff39320edca4e3337db294afb2d498aa249ec24320e1b77f170645af804f086
5
5
  SHA512:
6
- metadata.gz: 0713dd1a8a2acbe4bbb30eab946cc148c1c5b101f09fc1992a9384ae438f5a252df7f07c6c756dea259fbfe6525dcc0eee60b403a5b583790cc5634643926a03
7
- data.tar.gz: 4c18b39f4e3edd1b288dabfade13c3867b4223e50521f545746d5c27b1776782603fc8225de9c03869ba608e55a676a1c2f84c737e4c3a22f573edf62f8b836d
6
+ metadata.gz: 64cc092929a5189a4b5b610b329c2708aebbd4c7e586114d0a80be10d3b5267637d068713e8719a22a87fb8ff196ffd7ddc69aa09b8139d45f19fa410b4385d4
7
+ data.tar.gz: 6af5dbf4e3d3e44c8c0e1eddcda88779723f49eeda41f493eeed7ba6956864eef591bff5b1c35eaf1175efd4705907b8e28044d4a5ea07c34b88cf9b38c8dcff
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-appcenter)
4
4
  [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-appcenter.svg)](https://badge.fury.io/rb/fastlane-plugin-appcenter)
5
- [![Build Status](https://travis-ci.org/Microsoft/fastlane-plugin-appcenter.svg?branch=master)](https://travis-ci.org/Microsoft/fastlane-plugin-appcenter)
5
+ [![Build Status](https://travis-ci.org/microsoft/fastlane-plugin-appcenter.svg?branch=master)](https://travis-ci.org/microsoft/fastlane-plugin-appcenter)
6
6
 
7
7
  ## Getting Started
8
8
 
@@ -24,7 +24,8 @@ appcenter_upload(
24
24
  api_token: "<appcenter token>",
25
25
  owner_name: "<your appcenter account name>",
26
26
  app_name: "<your app name>",
27
- apk: "<path to android build binary>"
27
+ apk: "<path to android build binary>",
28
+ notify_testers: true # Set to false if you don't want to notify testers of your new release (default: `false`)
28
29
  )
29
30
  ```
30
31
 
@@ -39,7 +40,7 @@ The action parameters `api_token` and `owner_name` can also be omitted when thei
39
40
  - `APPCENTER_DISTRIBUTE_UPLOAD_DSYM_ONLY` - Flag to upload only the dSYM file to App Center
40
41
  - `APPCENTER_DISTRIBUTE_GROUP` - Comma separated list of Distribution Group names
41
42
  - `APPCENTER_DISTRIBUTE_MANDATORY_UPDATE` - Require users to update to this release
42
- - `APPCENTER_DISTRIBUTE_NOTIFY_TESTERS` - Send email notification about release
43
+ - `APPCENTER_DISTRIBUTE_NOTIFY_TESTERS` - Send email notification about release (default: `false`)
43
44
  - `APPCENTER_DISTRIBUTE_RELEASE_NOTES` - Release notes
44
45
  - `APPCENTER_DISTRIBUTE_RELEASE_NOTES_CLIPPING` - Clip release notes if its length is more then 5000, `true` by default
45
46
  - `APPCENTER_DISTRIBUTE_RELEASE_NOTES_LINK` - Additional release notes link
@@ -70,7 +71,7 @@ rubocop -a
70
71
 
71
72
  ## Issues and Feedback
72
73
 
73
- For any other issues and feedback about this plugin, please open a [GitHub issue](https://github.com/Microsoft/fastlane-plugin-appcenter/issues).
74
+ For any other issues and feedback about this plugin, please open a [GitHub issue](https://github.com/microsoft/fastlane-plugin-appcenter/issues).
74
75
 
75
76
  ## Troubleshooting
76
77
 
@@ -18,6 +18,8 @@ module Fastlane
18
18
  app_name = params[:app_name]
19
19
  file = params[:ipa]
20
20
  dsym = params[:dsym]
21
+ build_number = params[:build_number]
22
+ version = params[:version]
21
23
 
22
24
  dsym_path = nil
23
25
  if dsym
@@ -42,7 +44,13 @@ module Fastlane
42
44
  values[:dsym_path] = dsym_path
43
45
 
44
46
  UI.message("Starting dSYM upload...")
45
- dsym_upload_details = Helper::AppcenterHelper.create_dsym_upload(api_token, owner_name, app_name)
47
+
48
+ if File.extname(dsym_path) == ".txt"
49
+ file_name = File.basename(dsym_path)
50
+ dsym_upload_details = Helper::AppcenterHelper.create_mapping_upload(api_token, owner_name, app_name, file_name ,build_number, version)
51
+ else
52
+ dsym_upload_details = Helper::AppcenterHelper.create_dsym_upload(api_token, owner_name, app_name)
53
+ end
46
54
 
47
55
  if dsym_upload_details
48
56
  symbol_upload_id = dsym_upload_details['symbol_upload_id']
@@ -60,7 +68,8 @@ module Fastlane
60
68
  api_token = params[:api_token]
61
69
  owner_name = params[:owner_name]
62
70
  app_name = params[:app_name]
63
- group = params[:group]
71
+ destinations = params[:destinations]
72
+ destination_type = params[:destination_type]
64
73
  mandatory_update = params[:mandatory_update]
65
74
  notify_testers = params[:notify_testers]
66
75
  release_notes = params[:release_notes]
@@ -85,7 +94,6 @@ module Fastlane
85
94
  ].detect { |e| !e.to_s.empty? }
86
95
 
87
96
  UI.user_error!("Couldn't find build file at path '#{file}'") unless file && File.exist?(file)
88
- UI.user_error!("No Distribute Group given, pass using `group: 'group name'`") unless group && !group.empty?
89
97
 
90
98
  UI.message("Starting release upload...")
91
99
  upload_details = Helper::AppcenterHelper.create_release_upload(api_token, owner_name, app_name)
@@ -102,19 +110,19 @@ module Fastlane
102
110
 
103
111
  Helper::AppcenterHelper.update_release(api_token, owner_name, app_name, release_id, release_notes)
104
112
 
105
- groups = group.split(',')
106
- groups.each do |group_name|
107
- group = Helper::AppcenterHelper.get_group(api_token, owner_name, app_name, group_name)
108
- if group
109
- group_id = group['id']
110
- distributed_release = Helper::AppcenterHelper.add_to_group(api_token, owner_name, app_name, release_id, group_id, mandatory_update, notify_testers)
113
+ destinations_array = destinations.split(',')
114
+ destinations_array.each do |destination_name|
115
+ destination = Helper::AppcenterHelper.get_destination(api_token, owner_name, app_name, destination_type, destination_name)
116
+ if destination
117
+ destination_id = destination['id']
118
+ distributed_release = Helper::AppcenterHelper.add_to_destination(api_token, owner_name, app_name, release_id, destination_type, destination_id, mandatory_update, notify_testers)
111
119
  if distributed_release
112
- UI.success("Release #{distributed_release['short_version']} was successfully distributed to group \"#{group_name}\"")
120
+ UI.success("Release #{distributed_release['short_version']} was successfully distributed to #{destination_type} \"#{destination_name}\"")
113
121
  else
114
122
  UI.error("Release '#{release_id}' was not found")
115
123
  end
116
124
  else
117
- UI.error("Group '#{group_name}' was not found")
125
+ UI.error("#{destination_type} '#{destination_name}' was not found")
118
126
  end
119
127
  end
120
128
  end
@@ -253,20 +261,41 @@ module Fastlane
253
261
  FastlaneCore::ConfigItem.new(key: :group,
254
262
  env_name: "APPCENTER_DISTRIBUTE_GROUP",
255
263
  description: "Comma separated list of Distribution Group names",
264
+ optional: true,
265
+ type: String,
266
+ deprecated: true,
267
+ verify_block: proc do |value|
268
+ UI.user_error!("Option `group` is deprecated. Use `destinations` and `destination_type`")
269
+ end),
270
+
271
+ FastlaneCore::ConfigItem.new(key: :destinations,
272
+ env_name: "APPCENTER_DISTRIBUTE_DESTINATIONS",
273
+ description: "Comma separated list of destination names. Both distribution groups and stores are supported. All names are required to be of the same destination type",
256
274
  default_value: "Collaborators",
257
275
  optional: true,
258
276
  type: String),
259
277
 
278
+
279
+ FastlaneCore::ConfigItem.new(key: :destination_type,
280
+ env_name: "APPCENTER_DISTRIBUTE_DESTINATION_TYPE",
281
+ description: "Destination type of distribution destination. 'group' and 'store' are supported",
282
+ default_value: "group",
283
+ optional: true,
284
+ type: String,
285
+ verify_block: proc do |value|
286
+ UI.user_error!("No or incorrect destination type given. Use 'group' or 'store'") unless value && !value.empty? && ["group", "store"].include?(value)
287
+ end),
288
+
260
289
  FastlaneCore::ConfigItem.new(key: :mandatory_update,
261
290
  env_name: "APPCENTER_DISTRIBUTE_MANDATORY_UPDATE",
262
- description: "Require users to update to this release",
291
+ description: "Require users to update to this release. Ignored if destination type is 'store'",
263
292
  optional: true,
264
293
  is_string: false,
265
294
  default_value: false),
266
295
 
267
296
  FastlaneCore::ConfigItem.new(key: :notify_testers,
268
297
  env_name: "APPCENTER_DISTRIBUTE_NOTIFY_TESTERS",
269
- description: "Send email notification about release",
298
+ description: "Send email notification about release. Ignored if destination type is 'store'",
270
299
  optional: true,
271
300
  is_string: false,
272
301
  default_value: false),
@@ -289,7 +318,19 @@ module Fastlane
289
318
  env_name: "APPCENTER_DISTRIBUTE_RELEASE_NOTES_LINK",
290
319
  description: "Additional release notes link",
291
320
  optional: true,
292
- type: String)
321
+ type: String),
322
+
323
+ FastlaneCore::ConfigItem.new(key: :build_number,
324
+ env_name: "APPCENTER_DISTRIBUTE_BUILD_NUMBER",
325
+ description: "The build number. Used (and required) for uploading Android ProGuard mapping file",
326
+ optional: true,
327
+ type: String),
328
+
329
+ FastlaneCore::ConfigItem.new(key: :version,
330
+ env_name: "APPCENTER_DISTRIBUTE_VERSION",
331
+ description: "The version number. Used (and required) for uploading Android ProGuard mapping file",
332
+ optional: true,
333
+ type: String),
293
334
  ]
294
335
  end
295
336
 
@@ -311,20 +352,24 @@ module Fastlane
311
352
  owner_name: "appcenter_owner",
312
353
  app_name: "testing_app",
313
354
  apk: "./app-release.apk",
314
- group: "Testers",
315
- release_notes: "release notes"
355
+ destinations: "Testers",
356
+ destination_type: "group",
357
+ release_notes: "release notes",
358
+ notify_testers: false
316
359
  )',
317
360
  'appcenter_upload(
318
361
  api_token: "...",
319
362
  owner_name: "appcenter_owner",
320
363
  app_name: "testing_app",
321
364
  apk: "./app-release.ipa",
322
- group: "Testers,Alpha",
365
+ destinations: "Testers,Alpha",
366
+ destination_type: "group",
323
367
  dsym: "./app.dSYM.zip",
324
- release_notes: "release notes"
368
+ release_notes: "release notes",
369
+ notify_testers: false
325
370
  )'
326
371
  ]
327
372
  end
328
373
  end
329
374
  end
330
- end
375
+ end
@@ -54,6 +54,42 @@ module Fastlane
54
54
  end
55
55
  end
56
56
 
57
+ # creates new mapping upload in appcenter
58
+ # returns:
59
+ # symbol_upload_id
60
+ # upload_url
61
+ # expiration_date
62
+ def self.create_mapping_upload(api_token, owner_name, app_name, file_name, build_number, version)
63
+ connection = self.connection
64
+
65
+ response = connection.post do |req|
66
+ req.url("/v0.1/apps/#{owner_name}/#{app_name}/symbol_uploads")
67
+ req.headers['X-API-Token'] = api_token
68
+ req.headers['internal-request-source'] = "fastlane"
69
+ req.body = {
70
+ symbol_type: "AndroidProguard",
71
+ file_name: file_name,
72
+ build: build_number,
73
+ version: version,
74
+ }
75
+ end
76
+
77
+ case response.status
78
+ when 200...300
79
+ UI.message("DEBUG: #{JSON.pretty_generate(response.body)}\n") if ENV['DEBUG']
80
+ response.body
81
+ when 401
82
+ UI.user_error!("Auth Error, provided invalid token")
83
+ false
84
+ when 404
85
+ UI.error("Not found, invalid owner or application name")
86
+ false
87
+ else
88
+ UI.error("Error #{response.status}: #{response.body}")
89
+ false
90
+ end
91
+ end
92
+
57
93
  # creates new dSYM upload in appcenter
58
94
  # returns:
59
95
  # symbol_upload_id
@@ -209,26 +245,26 @@ module Fastlane
209
245
  end
210
246
  end
211
247
 
212
- # get distribution group
213
- def self.get_group(api_token, owner_name, app_name, group_name)
248
+ # get distribution group or store
249
+ def self.get_destination(api_token, owner_name, app_name, destination_type, destination_name)
214
250
  connection = self.connection
215
251
 
216
252
  response = connection.get do |req|
217
- req.url("/v0.1/apps/#{owner_name}/#{app_name}/distribution_groups/#{ERB::Util.url_encode(group_name)}")
253
+ req.url("/v0.1/apps/#{owner_name}/#{app_name}/distribution_#{destination_type}s/#{ERB::Util.url_encode(destination_name)}")
218
254
  req.headers['X-API-Token'] = api_token
219
255
  req.headers['internal-request-source'] = "fastlane"
220
256
  end
221
257
 
222
258
  case response.status
223
259
  when 200...300
224
- group = response.body
225
- UI.message("DEBUG: received group #{JSON.pretty_generate(group)}") if ENV['DEBUG']
226
- group
260
+ destination = response.body
261
+ UI.message("DEBUG: received #{destination_type} #{JSON.pretty_generate(destination)}") if ENV['DEBUG']
262
+ destination
227
263
  when 404
228
- UI.error("Not found, invalid distribution group name")
264
+ UI.error("Not found, invalid distribution #{destination_type} name")
229
265
  false
230
266
  else
231
- UI.error("Error getting group #{response.status}: #{response.body}")
267
+ UI.error("Error getting #{destination_type} #{response.status}: #{response.body}")
232
268
  false
233
269
  end
234
270
  end
@@ -270,21 +306,23 @@ module Fastlane
270
306
  end
271
307
  end
272
308
 
273
- # add release to distribution group
274
- def self.add_to_group(api_token, owner_name, app_name, release_id, group_id, mandatory_update = false, notify_testers = false)
309
+ # add release to distribution group or store
310
+ def self.add_to_destination(api_token, owner_name, app_name, release_id, destination_type, destination_id, mandatory_update = false, notify_testers = false)
275
311
  connection = self.connection
276
312
 
277
313
  UI.message("DEBUG: getting #{release_id}") if ENV['DEBUG']
278
314
 
315
+ body = { "id" => destination_id }
316
+ if destination_type == "group"
317
+ body["mandatory_update"] = mandatory_update
318
+ body["notify_testers"] = notify_testers
319
+ end
320
+
279
321
  response = connection.post do |req|
280
- req.url("/v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}/groups")
322
+ req.url("/v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}/#{destination_type}s")
281
323
  req.headers['X-API-Token'] = api_token
282
324
  req.headers['internal-request-source'] = "fastlane"
283
- req.body = {
284
- "id" => group_id,
285
- "mandatory_update" => mandatory_update,
286
- "notify_testers" => notify_testers
287
- }
325
+ req.body = body
288
326
  end
289
327
 
290
328
  case response.status
@@ -303,10 +341,10 @@ module Fastlane
303
341
 
304
342
  release
305
343
  when 404
306
- UI.error("Not found, invalid distribution group name")
344
+ UI.error("Not found, invalid distribution #{destination_type} name")
307
345
  false
308
346
  else
309
- UI.error("Error adding to group #{response.status}: #{response.body}")
347
+ UI.error("Error adding to #{destination_type} #{response.status}: #{response.body}")
310
348
  false
311
349
  end
312
350
  end
@@ -363,4 +401,4 @@ module Fastlane
363
401
  end
364
402
  end
365
403
  end
366
- end
404
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Appcenter
3
- VERSION = "0.2.2"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-appcenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2019-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,7 +106,7 @@ files:
106
106
  - lib/fastlane/plugin/appcenter/actions/appcenter_upload_action.rb
107
107
  - lib/fastlane/plugin/appcenter/helper/appcenter_helper.rb
108
108
  - lib/fastlane/plugin/appcenter/version.rb
109
- homepage: https://github.com/Microsoft/fastlane-plugin-appcenter
109
+ homepage: https://github.com/microsoft/fastlane-plugin-appcenter
110
110
  licenses:
111
111
  - MIT
112
112
  metadata: {}