fastlane-plugin-appcenter 1.9.0 → 1.10.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63dc35fc59b2bd98c82d21b139557a0ce06fbdd137367391435cee95d119045d
|
4
|
+
data.tar.gz: 2aa31b4b0d0091f35a0953c89ddbe69bfc0ca6d4b05193a3654455ff1bdd27b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa2bf15c7177cbaaa9108e1d151e82a3f145467359765caa064e1d11462554de7b018263ccf023805dab4afe52d138aa055f9657af2ab8d3e91e01149807cb2e
|
7
|
+
data.tar.gz: 1089271e589573573bf89a528ab0c97f562cf2ba3136276dcdf52fc2806f7229af9128b9c16419c011a88d1bb1fb11aa556131107d381de2141e99f98bc076d8
|
data/README.md
CHANGED
@@ -52,7 +52,8 @@ appcenter_upload(
|
|
52
52
|
appcenter_fetch_version_number(
|
53
53
|
api_token: "<appcenter token>",
|
54
54
|
owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
|
55
|
-
app_name: "<appcenter app name (as seen in app URL)>"
|
55
|
+
app_name: "<appcenter app name (as seen in app URL)>",
|
56
|
+
version: "a specific version to get the last release for" # optional, don't set this value to get the last upload of all versions
|
56
57
|
)
|
57
58
|
```
|
58
59
|
|
@@ -130,6 +131,7 @@ Here is the list of all existing parameters:
|
|
130
131
|
| `api_token` <br/> `APPCENTER_API_TOKEN` | API Token for App Center |
|
131
132
|
| `owner_name` <br/> `APPCENTER_OWNER_NAME` | Owner name, as found in the App's URL in App Center |
|
132
133
|
| `app_name` <br/> `APPCENTER_APP_NAME` | App name as found in the App's URL in App Center. If there is no app with such name, you will be prompted to create one |
|
134
|
+
| `version` <br/> `APPCENTER_APP_VERSION` | App version to get the last release for instead of the last release of all versions |
|
133
135
|
|
134
136
|
## Example
|
135
137
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "json"
|
2
|
+
require "net/http"
|
3
|
+
require "fastlane_core/ui/ui"
|
4
4
|
|
5
5
|
module Fastlane
|
6
6
|
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
@@ -8,38 +8,51 @@ module Fastlane
|
|
8
8
|
module Actions
|
9
9
|
class AppcenterFetchVersionNumberAction < Action
|
10
10
|
def self.description
|
11
|
-
"Fetches the latest version number of an app from App Center"
|
11
|
+
"Fetches the latest version number of an app or the last build number of a version from App Center"
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.authors
|
15
|
-
["jspargo", "ShopKeep"]
|
15
|
+
["jspargo", "ShopKeep", "Qutaibah"]
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.run(params)
|
19
19
|
api_token = params[:api_token]
|
20
20
|
app_name = params[:app_name]
|
21
21
|
owner_name = params[:owner_name]
|
22
|
+
version = params[:version]
|
22
23
|
|
23
24
|
releases = Helper::AppcenterHelper.fetch_releases(
|
24
25
|
api_token: api_token,
|
25
26
|
owner_name: owner_name,
|
26
|
-
app_name: app_name
|
27
|
+
app_name: app_name,
|
27
28
|
)
|
28
29
|
|
29
30
|
UI.abort_with_message!("No versions found for '#{app_name}' owned by #{owner_name}") unless releases
|
30
|
-
|
31
|
-
|
31
|
+
|
32
|
+
sorted_releases = releases
|
33
|
+
|
34
|
+
if version.nil?
|
35
|
+
sorted_releases = releases.sort_by { |release| release["id"] }
|
36
|
+
else
|
37
|
+
sorted_releases = releases.select { |release| release["short_version"] == version }.sort_by { |release| release["id"] }
|
38
|
+
end
|
39
|
+
|
40
|
+
latest_release = sorted_releases.last
|
32
41
|
|
33
42
|
if latest_release.nil?
|
34
|
-
|
43
|
+
if version.nil?
|
44
|
+
UI.user_error!("This app has no releases yet")
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
UI.user_error!("The provided version (#{version}) has no releases yet")
|
35
48
|
return nil
|
36
49
|
end
|
37
50
|
|
38
51
|
return {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
52
|
+
"id" => latest_release["id"],
|
53
|
+
"version" => latest_release["short_version"],
|
54
|
+
"build_number" => latest_release["version"],
|
55
|
+
}
|
43
56
|
end
|
44
57
|
|
45
58
|
def self.available_options
|
@@ -61,7 +74,13 @@ module Fastlane
|
|
61
74
|
description: "Name of the application on App Center",
|
62
75
|
verify_block: proc do |value|
|
63
76
|
UI.user_error!("No app name for App Center given, pass using `app_name: 'app name'`") unless value && !value.empty?
|
64
|
-
end)
|
77
|
+
end),
|
78
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
79
|
+
env_name: "APPCENTER_APP_VERSION",
|
80
|
+
description: "The version to get the latest release for",
|
81
|
+
optional: true,
|
82
|
+
type: String),
|
83
|
+
|
65
84
|
]
|
66
85
|
end
|
67
86
|
|
@@ -70,11 +89,11 @@ module Fastlane
|
|
70
89
|
end
|
71
90
|
|
72
91
|
def self.get_apps(api_token)
|
73
|
-
host_uri = URI.parse(
|
92
|
+
host_uri = URI.parse("https://api.appcenter.ms")
|
74
93
|
http = Net::HTTP.new(host_uri.host, host_uri.port)
|
75
94
|
http.use_ssl = true
|
76
95
|
apps_request = Net::HTTP::Get.new("/v0.1/apps")
|
77
|
-
apps_request[
|
96
|
+
apps_request["X-API-Token"] = api_token
|
78
97
|
apps_response = http.request(apps_request)
|
79
98
|
return [] unless apps_response.kind_of?(Net::HTTPOK)
|
80
99
|
return JSON.parse(apps_response.body)
|
@@ -324,6 +324,7 @@ module Fastlane
|
|
324
324
|
req.options.timeout = timeout
|
325
325
|
req.headers['internal-request-source'] = "fastlane"
|
326
326
|
req.headers['Content-Length'] = chunk.length.to_s
|
327
|
+
req.headers['Content-Type'] = 'application/octet-stream'
|
327
328
|
req.body = chunk
|
328
329
|
end
|
329
330
|
UI.message("DEBUG: #{response.status} #{JSON.pretty_generate(response.body)}\n") if ENV['DEBUG']
|
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.
|
4
|
+
version: 1.10.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: 2020-
|
11
|
+
date: 2020-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|