fastlane-plugin-huawei_appgallery_connect 1.0.10 → 1.0.15
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 +4 -4
- data/README.md +54 -25
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb +24 -3
- data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_submit_for_review.rb +6 -0
- data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb +63 -10
- data/lib/fastlane/plugin/huawei_appgallery_connect/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8ad1b77f355b7d2284ad5e1cd0f161b2c643209cafbe79c3bd11c5de23405f2
|
4
|
+
data.tar.gz: f6dd1a859de8909d8e25b1485a5dd98130da965814e6246beadaf4c291f3f41d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cef05bbe6d2a076cca0e48d42e956717e792ebae5420c00e6c2c0b0ba805a186aa563c70f11268fc0d1b220b1ada355759f555c0f13fa37ad9bf0975b3409bc
|
7
|
+
data.tar.gz: 15771fc11e6da6d2deb8eb442c2b05e82c9d2f379bf64658617aa041bcf5f7c9507d926cf27d343bdc189f11c111f0ff91a449360a309801cedbf64ba76e9348
|
data/README.md
CHANGED
@@ -12,41 +12,70 @@ fastlane add_plugin huawei_appgallery_connect
|
|
12
12
|
|
13
13
|
## About huawei_appgallery_connect
|
14
14
|
|
15
|
-
Huawei AppGallery Connect Plugin
|
15
|
+
Huawei AppGallery Connect Plugin can be used to upload Android application on the Huawei App Gallery using fastlane.
|
16
16
|
|
17
|
-
|
17
|
+
## Usage
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
22
|
-
|
23
|
-
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
24
|
-
|
25
|
-
## Run tests for this plugin
|
26
|
-
|
27
|
-
To run both the tests, and code style validation, run
|
19
|
+
To get started you will need the client id, client Secret & app ID which can be obtained from your Huawei AppGallery Connect account.
|
28
20
|
|
29
21
|
```
|
30
|
-
|
22
|
+
huawei_appgallery_connect(
|
23
|
+
client_id: "<CLIENT_ID>",
|
24
|
+
client_secret: "<CLIENT_SECRET>",
|
25
|
+
app_id: "<APP_ID>",
|
26
|
+
apk_path: "<APK_PATH>"
|
27
|
+
|
28
|
+
# Optional, Parameter beyond this are optional
|
29
|
+
|
30
|
+
# if you're uploading aab instead of apk, specify is_aab to true and specify path to aab file on apk_path
|
31
|
+
is_aab: true
|
32
|
+
|
33
|
+
submit_for_review: false,
|
34
|
+
|
35
|
+
privacy_policy_url: "https://example.com",
|
36
|
+
changelog_path: "<PATH_TO_CHANGELOG_FILE>",
|
37
|
+
|
38
|
+
# release time to release app on specific date
|
39
|
+
release_time: "2019-12-25T07:05:15+0000",
|
40
|
+
|
41
|
+
# For phase wise release: set these parameters
|
42
|
+
phase_wise_release: true,
|
43
|
+
phase_release_start_time: "2019-12-25T07:05:15+0000",
|
44
|
+
phase_release_end_time: "2019-12-28T07:05:15+0000",
|
45
|
+
phase_release_percent: "10.00",
|
46
|
+
phase_release_description: "<DESCRIPTION>"
|
47
|
+
)
|
31
48
|
```
|
32
49
|
|
33
|
-
|
34
|
-
```
|
35
|
-
rubocop -a
|
36
|
-
```
|
50
|
+
The following action can be used to submit the app for review if submit_for_review was set to false during the upload of apk
|
37
51
|
|
38
|
-
|
39
|
-
|
40
|
-
|
52
|
+
```
|
53
|
+
huawei_appgallery_connect_submit_for_review(
|
54
|
+
client_id: "<CLIENT_ID>",
|
55
|
+
client_secret: "<CLIENT_SECRET>",
|
56
|
+
app_id: "<APP_ID>",
|
41
57
|
|
42
|
-
## Troubleshooting
|
43
58
|
|
44
|
-
|
59
|
+
# Optional, Parameter beyond this are optional
|
45
60
|
|
46
|
-
|
61
|
+
# release time to release app on specific date
|
62
|
+
release_time: "2019-12-25T07:05:15+0000",
|
47
63
|
|
48
|
-
For
|
64
|
+
# For phase wise release: set these parameters
|
65
|
+
phase_wise_release: true,
|
66
|
+
phase_release_start_time: "2019-12-25T07:05:15+0000",
|
67
|
+
phase_release_end_time: "2019-12-28T07:05:15+0000",
|
68
|
+
phase_release_percent: "10.00",
|
69
|
+
phase_release_description: "<DESCRIPTION>"
|
70
|
+
)
|
71
|
+
```
|
72
|
+
You can also retreive app info by making use of the following action
|
49
73
|
|
50
|
-
|
74
|
+
```
|
75
|
+
huawei_appgallery_connect_get_app_info(
|
76
|
+
client_id: "<CLIENT_ID>",
|
77
|
+
client_secret: "<CLIENT_SECRET>",
|
78
|
+
app_id: "<APP_ID>"
|
79
|
+
)
|
51
80
|
|
52
|
-
|
81
|
+
```
|
data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
CHANGED
@@ -15,13 +15,28 @@ module Fastlane
|
|
15
15
|
Helper::HuaweiAppgalleryConnectHelper.update_appinfo(params[:client_id], token, params[:app_id], params[:privacy_policy_url])
|
16
16
|
end
|
17
17
|
|
18
|
-
upload_app = Helper::HuaweiAppgalleryConnectHelper.upload_app(token, params[:client_id], params[:app_id], params[:apk_path])
|
18
|
+
upload_app = Helper::HuaweiAppgalleryConnectHelper.upload_app(token, params[:client_id], params[:app_id], params[:apk_path], params[:is_aab])
|
19
|
+
self.submit_for_review(token, upload_app, params)
|
19
20
|
|
20
|
-
|
21
|
+
end
|
22
|
+
# Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.submit_for_review(token, upload_app, params)
|
26
|
+
if params[:is_aab] && upload_app["success"] == true && params[:submit_for_review] != false
|
27
|
+
compilationStatus = Helper::HuaweiAppgalleryConnectHelper.query_aab_compilation_status(token, params, upload_app["pkgVersion"])
|
28
|
+
if compilationStatus == 1
|
29
|
+
UI.important("aab file is currently processing, waiting for 2 minutes...")
|
30
|
+
sleep(10)
|
31
|
+
self.submit_for_review(token, upload_app, params)
|
32
|
+
elsif compilationStatus == 2
|
21
33
|
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
34
|
+
else
|
35
|
+
UI.user_error!("Compilation of aab failed")
|
22
36
|
end
|
37
|
+
elsif upload_app["success"] == true && params[:submit_for_review] != false
|
38
|
+
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
23
39
|
end
|
24
|
-
# Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
|
25
40
|
end
|
26
41
|
|
27
42
|
def self.description
|
@@ -67,6 +82,12 @@ module Fastlane
|
|
67
82
|
optional: false,
|
68
83
|
type: String),
|
69
84
|
|
85
|
+
FastlaneCore::ConfigItem.new(key: :is_aab,
|
86
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_IS_AAB",
|
87
|
+
description: "Specify this to be true if you're uploading aab instead of apk",
|
88
|
+
optional: true,
|
89
|
+
type: Boolean),
|
90
|
+
|
70
91
|
FastlaneCore::ConfigItem.new(key: :changelog_path,
|
71
92
|
env_name: "HUAWEI_APPGALLERY_CONNECT_CHANGELOG_PATH",
|
72
93
|
description: "Path to Changelog file (Default empty)",
|
@@ -88,6 +88,12 @@ module Fastlane
|
|
88
88
|
description: "Release time in UTC format for app release on a specific date. The format is yyyy-MM-dd'T'HH:mm:ssZZ)",
|
89
89
|
optional: true,
|
90
90
|
conflicting_options: [:phase_wise_release],
|
91
|
+
type: String),
|
92
|
+
|
93
|
+
FastlaneCore::ConfigItem.new(key: :changelog_path,
|
94
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_CHANGELOG_PATH",
|
95
|
+
description: "Path to Changelog file (Default empty)",
|
96
|
+
optional: true,
|
91
97
|
type: String)
|
92
98
|
]
|
93
99
|
end
|
data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
CHANGED
@@ -76,10 +76,20 @@ module Fastlane
|
|
76
76
|
end
|
77
77
|
|
78
78
|
|
79
|
-
def self.upload_app(token, client_id, app_id, apk_path)
|
79
|
+
def self.upload_app(token, client_id, app_id, apk_path, is_aab)
|
80
80
|
UI.message("Fetching upload URL")
|
81
81
|
|
82
|
-
|
82
|
+
responseData = JSON.parse("{}")
|
83
|
+
responseData["success"] = false
|
84
|
+
responseData["code"] = 0
|
85
|
+
|
86
|
+
if(is_aab)
|
87
|
+
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url?appId=#{app_id}&suffix=aab")
|
88
|
+
upload_filename = "release.aab"
|
89
|
+
else
|
90
|
+
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/upload-url?appId=#{app_id}&suffix=apk")
|
91
|
+
upload_filename = "release.apk"
|
92
|
+
end
|
83
93
|
|
84
94
|
http = Net::HTTP.new(uri.host, uri.port)
|
85
95
|
http.use_ssl = true
|
@@ -91,14 +101,16 @@ module Fastlane
|
|
91
101
|
|
92
102
|
if !response.kind_of? Net::HTTPSuccess
|
93
103
|
UI.user_error!("Cannot obtain upload url, please check API Token / Permissions (status code: #{response.code})")
|
94
|
-
|
104
|
+
responseData["success"] = false
|
105
|
+
return responseData
|
95
106
|
end
|
96
107
|
|
97
108
|
result_json = JSON.parse(response.body)
|
98
109
|
|
99
110
|
if result_json['uploadUrl'].nil?
|
100
111
|
UI.user_error!('Cannot obtain upload url')
|
101
|
-
|
112
|
+
responseData["success"] = false
|
113
|
+
return responseData
|
102
114
|
else
|
103
115
|
UI.important('Uploading app')
|
104
116
|
# Upload App
|
@@ -115,7 +127,8 @@ module Fastlane
|
|
115
127
|
result = http.request(request)
|
116
128
|
if !result.kind_of? Net::HTTPSuccess
|
117
129
|
UI.user_error!("Cannot upload app, please check API Token / Permissions (status code: #{result.code})")
|
118
|
-
|
130
|
+
responseData["success"] = false
|
131
|
+
return responseData
|
119
132
|
end
|
120
133
|
result_json = JSON.parse(result.body)
|
121
134
|
|
@@ -130,10 +143,11 @@ module Fastlane
|
|
130
143
|
request = Net::HTTP::Put.new(uri.request_uri)
|
131
144
|
request["client_id"] = client_id
|
132
145
|
request["Authorization"] = "Bearer #{token}"
|
146
|
+
request['Content-Type'] = "application/json"
|
133
147
|
|
134
148
|
data = {fileType: 5, files: [{
|
135
149
|
|
136
|
-
fileName:
|
150
|
+
fileName: upload_filename,
|
137
151
|
fileDestUrl: result_json['result']['UploadFileRsp']['fileInfoList'][0]['fileDestUlr'],
|
138
152
|
size: result_json['result']['UploadFileRsp']['fileInfoList'][0]['size'].to_s
|
139
153
|
|
@@ -143,24 +157,57 @@ module Fastlane
|
|
143
157
|
response = http.request(request)
|
144
158
|
if !response.kind_of? Net::HTTPSuccess
|
145
159
|
UI.user_error!("Cannot save app info, please check API Token / Permissions (status code: #{response.code})")
|
146
|
-
|
160
|
+
responseData["success"] = false
|
161
|
+
return responseData
|
147
162
|
end
|
148
163
|
result_json = JSON.parse(response.body)
|
149
164
|
|
150
165
|
if result_json['ret']['code'] == 0
|
151
166
|
UI.success("App information saved.")
|
152
|
-
|
167
|
+
responseData["success"] = true
|
168
|
+
responseData["pkgVersion"] = result_json["pkgVersion"][0]
|
169
|
+
return responseData
|
153
170
|
else
|
154
171
|
UI.user_error!(result_json)
|
155
172
|
UI.user_error!("Failed to save app information")
|
156
|
-
|
173
|
+
responseData["success"] = false
|
174
|
+
return responseData
|
157
175
|
end
|
158
176
|
else
|
159
|
-
|
177
|
+
responseData["success"] = false
|
178
|
+
return responseData
|
160
179
|
end
|
161
180
|
end
|
162
181
|
end
|
163
182
|
|
183
|
+
def self.query_aab_compilation_status(token,params, pkgVersion)
|
184
|
+
UI.important("Checking aab compilation status")
|
185
|
+
|
186
|
+
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/aab/complile/status?appId=#{params[:app_id]}&pkgVersion=#{pkgVersion}")
|
187
|
+
|
188
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
189
|
+
http.use_ssl = true
|
190
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
191
|
+
request["client_id"] = params[:client_id]
|
192
|
+
request["Authorization"] = "Bearer #{token}"
|
193
|
+
|
194
|
+
response = http.request(request)
|
195
|
+
|
196
|
+
if !response.kind_of? Net::HTTPSuccess
|
197
|
+
UI.user_error!("Cannot query compilation status (status code: #{response.code}, body: #{response.body})")
|
198
|
+
return false
|
199
|
+
end
|
200
|
+
|
201
|
+
result_json = JSON.parse(response.body)
|
202
|
+
|
203
|
+
if result_json['ret']['code'] == 0
|
204
|
+
return result_json['aabCompileStatus']
|
205
|
+
else
|
206
|
+
UI.user_error!(result_json)
|
207
|
+
return -999
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
164
211
|
def self.submit_app_for_review(token, params)
|
165
212
|
UI.important("Submitting app for review")
|
166
213
|
|
@@ -226,6 +273,11 @@ module Fastlane
|
|
226
273
|
|
227
274
|
if result_json['ret']['code'] == 0
|
228
275
|
UI.success("Successfully submitted app for review")
|
276
|
+
elsif result_json['ret']['code'] == 204144660 && result_json['ret']['msg'].include?("It may take 2-5 minutes")
|
277
|
+
UI.important(result_json)
|
278
|
+
UI.important("Build is currently processing, waiting for 2 minutes before submitting again...")
|
279
|
+
sleep(120)
|
280
|
+
self.submit_app_for_review(token, params)
|
229
281
|
else
|
230
282
|
UI.user_error!(result_json)
|
231
283
|
UI.user_error!("Failed to submit app for review.")
|
@@ -235,3 +287,4 @@ module Fastlane
|
|
235
287
|
end
|
236
288
|
end
|
237
289
|
end
|
290
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-huawei_appgallery_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shreejan Shrestha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|