fastlane-plugin-appcenter 1.3.0 → 1.4.0

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: f94bfd3f235695b534b7ebb1ef47e7bf195cbae8e59abbb1d646e1d7b4790cda
4
- data.tar.gz: 142eb6d82abeb7d4bfe3fffa8e8127b00edcab7b2d57e557e0bb81cbf35471ce
3
+ metadata.gz: f420746739b204f6bfd6e9e5dd23f841028009e63ed49adf45107b053eeb24ac
4
+ data.tar.gz: '07896d07c221682028e2c59166c8d248a2ede8d953a3da408f734509eb10ae3a'
5
5
  SHA512:
6
- metadata.gz: fbdd60b80dda9c2e43d1d42b97a3e982a40b8e6deef76e086bdbecf0f00372b28e6821fc215cbf692b4d64589dce63b51d6a815053d4f348b2f1c07ee7b0f4ae
7
- data.tar.gz: 6207f85a258ca6ff2148172c36a5bb7a1de8aed26e13a2da3498d920a321f3846696d92e5244890c61b8b91e9fab57bf9e1d936856950470f4ea4a53b0ee7605
6
+ metadata.gz: 71b84cb05df74504d82d8aaf83626c999f69fdc06481fc072baada8aa29d24fd9e13652359f84a8cca5417b64f3457b5f33dd12d1a769e388e9aa430b0befb7e
7
+ data.tar.gz: 6e85fa4da98dfbba7a4147aad34aed090dc1e69224495be770587149dd0efb27747ac5b4ed4b7d1570b24656a610477dab359edbaaedcd6a05fde8d5ef50a452
data/README.md CHANGED
@@ -36,11 +36,11 @@ The action parameters `api_token` and `owner_name` can also be omitted when thei
36
36
  - `APPCENTER_OWNER_NAME` - Owner name
37
37
  - `APPCENTER_APP_NAME` - App name. If there is no app with such name, you will be prompted to create one
38
38
  - `APPCENTER_DISTRIBUTE_APK` - Build release path for android build
39
- - `APPCENTER_DISTRIBUTE_AAB` - Build release path for android app bundle build (preview)
39
+ - `APPCENTER_DISTRIBUTE_AAB` - Build release path for android app bundle build
40
40
  - `APPCENTER_DISTRIBUTE_IPA` - Build release path for ios build
41
- - `APPCENTER_DISTRIBUTE_DSYM` - Path to your symbols (app.dSYM.zip) file
41
+ - `APPCENTER_DISTRIBUTE_DSYM` - Path to your symbols (app.dSYM.zip) file
42
42
  - `APPCENTER_DISTRIBUTE_UPLOAD_DSYM_ONLY` - Flag to upload only the dSYM file to App Center
43
- - `APPCENTER_DISTRIBUTE_ANDROID_MAPPING` - Path to your Android mapping.txt file
43
+ - `APPCENTER_DISTRIBUTE_ANDROID_MAPPING` - Path to your Android mapping.txt file
44
44
  - `APPCENTER_DISTRIBUTE_UPLOAD_ANDROID_MAPPING_ONLY` - Flag to upload only the mapping file to App Center
45
45
  - `APPCENTER_DISTRIBUTE_DESTINATIONS` - Comma separated list of destination names. Both distribution groups and stores are supported. All names are required to be of the same destination type. Default is `Collaborators`.
46
46
  - `APPCENTER_DISTRIBUTE_DESTINATION_TYPE` - Destination type of distribution destination. `group` and `store` are supported. Default is `group`
@@ -44,7 +44,7 @@ module Fastlane
44
44
  values[:dsym_path] = dsym_path
45
45
 
46
46
  UI.message("Starting dSYM upload...")
47
-
47
+
48
48
  # TODO: this should eventually be removed once we have warned of deprecation for long enough
49
49
  if File.extname(dsym_path) == ".txt"
50
50
  file_name = File.basename(dsym_path)
@@ -103,6 +103,8 @@ module Fastlane
103
103
  should_clip = params[:should_clip]
104
104
  release_notes_link = params[:release_notes_link]
105
105
  timeout = params[:timeout]
106
+ build_number = params[:build_number]
107
+ version = params[:version]
106
108
 
107
109
  if release_notes.length >= Constants::MAX_RELEASE_NOTES_LENGTH
108
110
  unless should_clip
@@ -119,13 +121,42 @@ module Fastlane
119
121
  file = [
120
122
  params[:ipa],
121
123
  params[:apk],
122
- params[:aab]
124
+ params[:aab],
125
+ params[:file]
123
126
  ].detect { |e| !e.to_s.empty? }
124
127
 
125
128
  UI.user_error!("Couldn't find build file at path '#{file}'") unless file && File.exist?(file)
126
129
 
130
+ file_ext = Helper::AppcenterHelper.file_extname_full(file)
131
+ if destination_type == "group"
132
+ UI.user_error!("Can't distribute #{file_ext} to groups, please use `destination_type: 'store'`") if %w(.aab).include? file_ext
133
+ else
134
+ UI.user_error!("Can't distribute #{file_ext} to stores, please use `destination_type: 'group'`") if %w(.app .app.zip .dmg .pkg).include? file_ext
135
+ end
136
+
137
+ unless params[:file].to_s.empty?
138
+ if %w[.dmg .pkg].include? file_ext
139
+ UI.user_error!("Fields `version` and `build_number` must be specified to upload a #{file_ext} file") if build_number.to_s.empty? || version.to_s.empty?
140
+ release_upload_body = { build_version: version, build_number: build_number }
141
+ else
142
+ UI.message("Fields `version` and `build_number` are not required for files of type #{file_ext}, ignored") unless build_number.to_s.empty? && version.to_s.empty?
143
+ end
144
+ end
145
+
146
+ if file_ext == ".app" && File.directory?(file)
147
+ UI.message("App path is a directory, zipping it before upload")
148
+ zip_file = file + ".zip"
149
+ if File.exists? zip_file
150
+ override = UI.interactive? ? UI.confirm("File '#{zip_file}' already exists, do you want to override it?") : true
151
+ UI.abort_with_message!("Not overriding, aborting publishing operation") unless override
152
+ UI.message("Deleting zip file: #{zip_file}")
153
+ File.delete zip_file
154
+ end
155
+ file = Actions::ZipAction.run(path: file, output_path: zip_file)
156
+ end
157
+
127
158
  UI.message("Starting release upload...")
128
- upload_details = Helper::AppcenterHelper.create_release_upload(api_token, owner_name, app_name)
159
+ upload_details = Helper::AppcenterHelper.create_release_upload(api_token, owner_name, app_name, release_upload_body)
129
160
  if upload_details
130
161
  upload_id = upload_details['upload_id']
131
162
  upload_url = upload_details['upload_url']
@@ -154,7 +185,7 @@ module Fastlane
154
185
  UI.error("#{destination_type} '#{destination_name}' was not found")
155
186
  end
156
187
  end
157
- else
188
+ else
158
189
  UI.user_error!("Failed to upload release")
159
190
  end
160
191
  end
@@ -171,8 +202,9 @@ module Fastlane
171
202
  app_platform = params[:app_platform]
172
203
 
173
204
  platforms = {
174
- "Android" => ['Java', 'React-Native', 'Xamarin'],
175
- "iOS" => ['Objective-C-Swift', 'React-Native', 'Xamarin']
205
+ Android: %w[Java React-Native Xamarin],
206
+ iOS: %w[Objective-C-Swift React-Native Xamarin],
207
+ macOS: %w[Objective-C-Swift]
176
208
  }
177
209
 
178
210
  if Helper::AppcenterHelper.get_app(api_token, owner_name, app_name)
@@ -180,15 +212,14 @@ module Fastlane
180
212
  end
181
213
 
182
214
  should_create_app = !app_display_name.to_s.empty? || !app_os.to_s.empty? || !app_platform.to_s.empty?
183
-
215
+
184
216
  if Helper.test? || should_create_app || UI.confirm("App with name #{app_name} not found, create one?")
185
217
  app_display_name = app_name if app_display_name.to_s.empty?
186
- os = app_os.to_s.empty? ?
187
- (Helper.test? ? "Android" : UI.select("Select OS", ["Android", "iOS"])) :
188
- app_os
189
- platform = app_platform.to_s.empty? ?
190
- (Helper.test? ? "Java" : UI.select("Select Platform", platforms[os])) :
191
- app_platform
218
+ os = app_os.to_s.empty? && (Helper.test? ? "Android" : UI.select("Select OS", platforms.keys)) || app_os.to_s
219
+ platform = app_platform.to_s.empty? && (Helper.test? ? "Java" : app_platform.to_s) || app_platform.to_s
220
+ if platform.to_s.empty?
221
+ platform = platforms[os].length == 1 ? platforms[os][0] : UI.select("Select Platform", platforms[os])
222
+ end
192
223
 
193
224
  Helper::AppcenterHelper.create_app(api_token, owner_type, owner_name, app_name, app_display_name, os, platform)
194
225
  else
@@ -288,22 +319,23 @@ module Fastlane
288
319
  default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
289
320
  optional: true,
290
321
  type: String,
291
- conflicting_options: [:ipa, :aab],
322
+ conflicting_options: [:ipa, :aab, :file],
292
323
  conflict_block: proc do |value|
293
324
  UI.user_error!("You can't use 'apk' and '#{value.key}' options in one run")
294
325
  end,
295
326
  verify_block: proc do |value|
296
327
  accepted_formats = [".apk"]
297
- UI.user_error!("Only \".apk\" formats are allowed, you provided \"#{File.extname(value)}\"") unless accepted_formats.include? File.extname(value)
328
+ file_extname_full = Helper::AppcenterHelper.file_extname_full(value)
329
+ UI.user_error!("Only \".apk\" formats are allowed, you provided \"#{file_extname_full}\"") unless accepted_formats.include? file_extname_full
298
330
  end),
299
331
 
300
332
  FastlaneCore::ConfigItem.new(key: :aab,
301
333
  env_name: "APPCENTER_DISTRIBUTE_AAB",
302
- description: "Build release path for android app bundle build (preview)",
334
+ description: "Build release path for android app bundle build",
303
335
  default_value: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
304
336
  optional: true,
305
337
  type: String,
306
- conflicting_options: [:ipa, :apk],
338
+ conflicting_options: [:ipa, :apk, :file],
307
339
  conflict_block: proc do |value|
308
340
  UI.user_error!("You can't use 'aab' and '#{value.key}' options in one run")
309
341
  end,
@@ -314,11 +346,11 @@ module Fastlane
314
346
 
315
347
  FastlaneCore::ConfigItem.new(key: :ipa,
316
348
  env_name: "APPCENTER_DISTRIBUTE_IPA",
317
- description: "Build release path for ios build",
349
+ description: "Build release path for iOS builds",
318
350
  default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
319
351
  optional: true,
320
352
  type: String,
321
- conflicting_options: [:apk, :aab],
353
+ conflicting_options: [:apk, :aab, :file],
322
354
  conflict_block: proc do |value|
323
355
  UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
324
356
  end,
@@ -327,6 +359,21 @@ module Fastlane
327
359
  UI.user_error!("Only \".ipa\" formats are allowed, you provided \"#{File.extname(value)}\"") unless accepted_formats.include? File.extname(value)
328
360
  end),
329
361
 
362
+ FastlaneCore::ConfigItem.new(key: :file,
363
+ env_name: "APPCENTER_DISTRIBUTE_FILE",
364
+ description: "Build release path for generic builds (.aab, .app, .app.zip, .apk, .dmg, .ipa, .pkg)",
365
+ optional: true,
366
+ type: String,
367
+ conflicting_options: [:apk, :aab, :ipa],
368
+ conflict_block: proc do |value|
369
+ UI.user_error!("You can't use 'file' and '#{value.key}' options in one run")
370
+ end,
371
+ verify_block: proc do |value|
372
+ accepted_formats = %w(.aab .app .app.zip .apk .dmg .ipa .pkg)
373
+ file_ext = Helper::AppcenterHelper.file_extname_full(value)
374
+ UI.user_error!("Only #{accepted_formats.to_s} formats are allowed, you provided \"#{file_ext}\"") unless accepted_formats.include? file_ext
375
+ end),
376
+
330
377
  FastlaneCore::ConfigItem.new(key: :dsym,
331
378
  env_name: "APPCENTER_DISTRIBUTE_DSYM",
332
379
  description: "Path to your symbols file. For iOS provide path to app.dSYM.zip",
@@ -432,13 +479,13 @@ module Fastlane
432
479
 
433
480
  FastlaneCore::ConfigItem.new(key: :build_number,
434
481
  env_name: "APPCENTER_DISTRIBUTE_BUILD_NUMBER",
435
- description: "The build number. Used (and required) for uploading Android ProGuard mapping file",
482
+ description: "The build number, required for Android ProGuard mapping files, as well as macOS .pkg and .dmg builds",
436
483
  optional: true,
437
484
  type: String),
438
485
 
439
486
  FastlaneCore::ConfigItem.new(key: :version,
440
487
  env_name: "APPCENTER_DISTRIBUTE_VERSION",
441
- description: "The version number. Used (and required) for uploading Android ProGuard mapping file",
488
+ description: "The build version, required for Android ProGuard mapping files, as well as macOS .pkg and .dmg builds",
442
489
  optional: true,
443
490
  type: String),
444
491
 
@@ -2,6 +2,19 @@ module Fastlane
2
2
  module Helper
3
3
  class AppcenterHelper
4
4
 
5
+ # basic utility method to check file types that App Center will accept,
6
+ # accounting for file types that can and should be zip-compressed
7
+ # before they are uploaded
8
+ def self.file_extname_full(path)
9
+ is_zip = File.extname(path) == ".zip"
10
+
11
+ # if file is not .zip'ed, these do not change basename and extname
12
+ unzip_basename = File.basename(path, ".zip")
13
+ unzip_extname = File.extname(unzip_basename)
14
+
15
+ is_zip ? unzip_extname + ".zip" : unzip_extname
16
+ end
17
+
5
18
  # create request
6
19
  def self.connection(upload_url = false, dsym = false)
7
20
  require 'faraday'
@@ -28,13 +41,13 @@ module Fastlane
28
41
  # returns:
29
42
  # upload_id
30
43
  # upload_url
31
- def self.create_release_upload(api_token, owner_name, app_name)
44
+ def self.create_release_upload(api_token, owner_name, app_name, body)
32
45
  connection = self.connection
33
46
 
34
47
  response = connection.post("v0.1/apps/#{owner_name}/#{app_name}/release_uploads") do |req|
35
48
  req.headers['X-API-Token'] = api_token
36
49
  req.headers['internal-request-source'] = "fastlane"
37
- req.body = {}
50
+ req.body = body.nil? && {} || body
38
51
  end
39
52
 
40
53
  case response.status
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Appcenter
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.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: 1.3.0
4
+ version: 1.4.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-08-14 00:00:00.000000000 Z
11
+ date: 2019-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubyforge_project:
129
- rubygems_version: 2.7.6
128
+ rubygems_version: 3.0.4
130
129
  signing_key:
131
130
  specification_version: 4
132
131
  summary: Fastlane plugin for App Center