fastlane-plugin-appcenter 1.2.1 → 1.3.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: 3784671e2a8f06e8a2a65dfa66ee08bdc2b91b87f4c5d51b770ec3e429f21f89
4
- data.tar.gz: a4159d408e9653d55627798245dda024b9f14122d50e11c95312bbabd6ad3367
3
+ metadata.gz: f94bfd3f235695b534b7ebb1ef47e7bf195cbae8e59abbb1d646e1d7b4790cda
4
+ data.tar.gz: 142eb6d82abeb7d4bfe3fffa8e8127b00edcab7b2d57e557e0bb81cbf35471ce
5
5
  SHA512:
6
- metadata.gz: 32cc5d08c9d4112d7e2754c8f37af9184455de76ca5ace67fcb199e5b3b33ec7194d8221e5a9bfa03966632247687d405512e08328c5d1adbada892dca14f1bb
7
- data.tar.gz: b063b6498cb08291aceaef424a34d3a9dbd42d5ca678f252a4e98d142581ccda6248781fa3a7eeca2a26250cc868668b5daeae193ae9aff012b34754e147eb42
6
+ metadata.gz: fbdd60b80dda9c2e43d1d42b97a3e982a40b8e6deef76e086bdbecf0f00372b28e6821fc215cbf692b4d64589dce63b51d6a815053d4f348b2f1c07ee7b0f4ae
7
+ data.tar.gz: 6207f85a258ca6ff2148172c36a5bb7a1de8aed26e13a2da3498d920a321f3846696d92e5244890c61b8b91e9fab57bf9e1d936856950470f4ea4a53b0ee7605
data/README.md CHANGED
@@ -22,8 +22,8 @@ To get started, first, [obtain an API token](https://appcenter.ms/settings/apito
22
22
  ```ruby
23
23
  appcenter_upload(
24
24
  api_token: "<appcenter token>",
25
- owner_name: "<your appcenter account name>",
26
- app_name: "<your app name>",
25
+ owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
26
+ app_name: "<appcenter app name>",
27
27
  apk: "<path to android build binary>",
28
28
  notify_testers: true # Set to false if you don't want to notify testers of your new release (default: `false`)
29
29
  )
@@ -32,6 +32,7 @@ appcenter_upload(
32
32
  The action parameters `api_token` and `owner_name` can also be omitted when their values are [set as environment variables](https://docs.fastlane.tools/advanced/#environment-variables). Below a list of all available environment variables:
33
33
 
34
34
  - `APPCENTER_API_TOKEN` - API Token for App Center
35
+ - `APPCENTER_OWNER_TYPE` - Owner type - `user` or `organization` (default value is `user`)
35
36
  - `APPCENTER_OWNER_NAME` - Owner name
36
37
  - `APPCENTER_APP_NAME` - App name. If there is no app with such name, you will be prompted to create one
37
38
  - `APPCENTER_DISTRIBUTE_APK` - Build release path for android build
@@ -26,7 +26,7 @@ module Fastlane
26
26
  # we can use dsym parameter only if build file is ipa
27
27
  dsym_path = dsym if !file || File.extname(file) == '.ipa'
28
28
  else
29
- # if dsym is note set, but build is ipa - check default path
29
+ # if dsym is not set, but build is ipa - check default path
30
30
  if file && File.exist?(file) && File.extname(file) == '.ipa'
31
31
  dsym_path = file.to_s.gsub('.ipa', '.dSYM.zip')
32
32
  UI.message("dSYM is found")
@@ -163,6 +163,7 @@ module Fastlane
163
163
  # checks app existance, if ther is no such - creates it
164
164
  def self.get_or_create_app(params)
165
165
  api_token = params[:api_token]
166
+ owner_type = params[:owner_type]
166
167
  owner_name = params[:owner_name]
167
168
  app_name = params[:app_name]
168
169
  app_display_name = params[:app_display_name]
@@ -189,7 +190,7 @@ module Fastlane
189
190
  (Helper.test? ? "Java" : UI.select("Select Platform", platforms[os])) :
190
191
  app_platform
191
192
 
192
- Helper::AppcenterHelper.create_app(api_token, owner_name, app_name, app_display_name, os, platform)
193
+ Helper::AppcenterHelper.create_app(api_token, owner_type, owner_name, app_name, app_display_name, os, platform)
193
194
  else
194
195
  UI.error("Lane aborted")
195
196
  false
@@ -234,6 +235,17 @@ module Fastlane
234
235
  UI.user_error!("No API token for App Center given, pass using `api_token: 'token'`") unless value && !value.empty?
235
236
  end),
236
237
 
238
+ FastlaneCore::ConfigItem.new(key: :owner_type,
239
+ env_name: "APPCENTER_OWNER_TYPE",
240
+ description: "Owner type",
241
+ optional: true,
242
+ default_value: "user",
243
+ type: String,
244
+ verify_block: proc do |value|
245
+ accepted_formats = ["user", "organization"]
246
+ UI.user_error!("Only \"user\" and \"organization\" types are allowed, you provided \"#{File.extname(value)}\"") unless accepted_formats.include? value
247
+ end),
248
+
237
249
  FastlaneCore::ConfigItem.new(key: :owner_name,
238
250
  env_name: "APPCENTER_OWNER_NAME",
239
251
  description: "Owner name",
@@ -492,4 +504,4 @@ module Fastlane
492
504
  end
493
505
  end
494
506
  end
495
- end
507
+ end
@@ -371,10 +371,12 @@ module Fastlane
371
371
  end
372
372
 
373
373
  # returns true if app exists, false in case of 404 and error otherwise
374
- def self.create_app(api_token, owner_name, app_name, app_display_name, os, platform)
374
+ def self.create_app(api_token, owner_type, owner_name, app_name, app_display_name, os, platform)
375
375
  connection = self.connection
376
376
 
377
- response = connection.post("v0.1/apps") do |req|
377
+ endpoint = owner_type == "user" ? "v0.1/apps" : "v0.1/orgs/#{owner_name}/apps"
378
+
379
+ response = connection.post(endpoint) do |req|
378
380
  req.headers['X-API-Token'] = api_token
379
381
  req.headers['internal-request-source'] = "fastlane"
380
382
  req.body = {
@@ -389,7 +391,7 @@ module Fastlane
389
391
  when 200...300
390
392
  created = response.body
391
393
  UI.message("DEBUG: #{JSON.pretty_generate(created)}") if ENV['DEBUG']
392
- UI.success("Created #{os}/#{platform} app with name \"#{created['name']}\" and display name \"#{created['display_name']}\"")
394
+ UI.success("Created #{os}/#{platform} app with name \"#{created['name']}\" and display name \"#{created['display_name']}\" for #{owner_type} \"#{owner_name}\"")
393
395
  true
394
396
  else
395
397
  UI.error("Error creating app #{response.status}: #{response.body}")
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Appcenter
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.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.2.1
4
+ version: 1.3.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-07-25 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler