fastlane-plugin-huawei_appgallery_connect 1.0.0 → 1.0.1
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/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb +56 -1
- data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb +83 -15
- 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: 44e2a92f0fd3533438a85c05db67fb92bede709ec85c24d6fbb42fdfc67df709
|
4
|
+
data.tar.gz: 62a88a91bbd6cb152eca59681b49ffc3403a42f3db111695b3c2ef58ac21d422
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbf2dcf0b3e1a7bd63c2f6b5146fbd7b2674254e58fad9c8b2a4d75d3e1c63142aeca309bb6de057b1e43a1bdc5bdb8205afbe52b3f5f83410eb193612702f74
|
7
|
+
data.tar.gz: 3b709b637bef4a6f0808d97a68fda4923fdd86d3506359628b4b9c0f182cfdc11bc2e566111df84fae77f4d3333541953a0c648d4ea799a3604477bacbe6d517
|
data/lib/fastlane/plugin/huawei_appgallery_connect/actions/huawei_appgallery_connect_action.rb
CHANGED
@@ -10,10 +10,15 @@ module Fastlane
|
|
10
10
|
if token.nil?
|
11
11
|
UI.message("Cannot retrieve token, please check your client ID and client secret")
|
12
12
|
else
|
13
|
+
|
14
|
+
if params[:privacy_policy_url] != nil
|
15
|
+
Helper::HuaweiAppgalleryConnectHelper.update_appinfo(params[:client_id], token, params[:app_id], params[:privacy_policy_url])
|
16
|
+
end
|
17
|
+
|
13
18
|
upload_app = Helper::HuaweiAppgalleryConnectHelper.upload_app(token, params[:client_id], params[:app_id], params[:apk_path])
|
14
19
|
|
15
20
|
if upload_app
|
16
|
-
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params
|
21
|
+
Helper::HuaweiAppgalleryConnectHelper.submit_app_for_review(token, params)
|
17
22
|
end
|
18
23
|
end
|
19
24
|
# Helper::HuaweiAppgalleryConnectHelper.getAppInfo(token, params[:client_id], params[:app_id])
|
@@ -60,6 +65,56 @@ module Fastlane
|
|
60
65
|
env_name: "HUAWEI_APPGALLERY_CONNECT_APK_PATH",
|
61
66
|
description: "Path to APK file for upload",
|
62
67
|
optional: false,
|
68
|
+
type: String),
|
69
|
+
|
70
|
+
FastlaneCore::ConfigItem.new(key: :changelog_path,
|
71
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_CHANGELOG_PATH",
|
72
|
+
description: "Path to Changelog file (Default empty)",
|
73
|
+
optional: true,
|
74
|
+
type: String),
|
75
|
+
|
76
|
+
FastlaneCore::ConfigItem.new(key: :privacy_policy_url,
|
77
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_PRIVACY",
|
78
|
+
description: "Privacy Policy URL",
|
79
|
+
optional: true,
|
80
|
+
type: String),
|
81
|
+
|
82
|
+
FastlaneCore::ConfigItem.new(key: :phase_wise_release,
|
83
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_PHASE_WISE_RELEASE",
|
84
|
+
description: "Phase wise release",
|
85
|
+
optional: true,
|
86
|
+
conflicting_options: [:release_time],
|
87
|
+
type: Boolean),
|
88
|
+
|
89
|
+
FastlaneCore::ConfigItem.new(key: :phase_release_start_time,
|
90
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_PHASE_WISE_RELEASE_START_TIME",
|
91
|
+
description: "Start time of the validity period of the release by phase. The value is UTC time in the following format: yyyy-MM-dd 'T' HH:mm:ssZZ",
|
92
|
+
optional: true,
|
93
|
+
type: String),
|
94
|
+
|
95
|
+
FastlaneCore::ConfigItem.new(key: :phase_release_end_time,
|
96
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_PHASE_WISE_RELEASE_END_TIME",
|
97
|
+
description: "End time of the validity period of the release by phase. The value is UTC time in the following format: yyyy-MM-dd 'T' HH:mm:ssZZ",
|
98
|
+
optional: true,
|
99
|
+
type: String),
|
100
|
+
|
101
|
+
FastlaneCore::ConfigItem.new(key: :phase_release_percent,
|
102
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_PHASE_WISE_RELEASE_PERCENT",
|
103
|
+
description: "Percentage of the release by phase. The value must be accurate to two decimal places and does not contain the percent sign (%)",
|
104
|
+
optional: true,
|
105
|
+
type: String),
|
106
|
+
|
107
|
+
FastlaneCore::ConfigItem.new(key: :phase_release_description,
|
108
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_PHASE_WISE_RELEASE_DESCRIPTION",
|
109
|
+
description: "Phase-based release description. (Max 500 characters)",
|
110
|
+
optional: true,
|
111
|
+
type: String),
|
112
|
+
|
113
|
+
FastlaneCore::ConfigItem.new(key: :release_time,
|
114
|
+
env_name: "HUAWEI_APPGALLERY_CONNECT_RELEASE_TIME",
|
115
|
+
description: "Release time in UTC format for app release on a specific date. The format is yyyy-MM-dd'T'HH:mm:ssZZ)",
|
116
|
+
optional: true,
|
117
|
+
conflicting_options: [:phase_wise_release],
|
63
118
|
type: String)
|
64
119
|
]
|
65
120
|
end
|
data/lib/fastlane/plugin/huawei_appgallery_connect/helper/huawei_appgallery_connect_helper.rb
CHANGED
@@ -6,7 +6,7 @@ module Fastlane
|
|
6
6
|
module Helper
|
7
7
|
class HuaweiAppgalleryConnectHelper
|
8
8
|
def self.get_token(client_id, client_secret)
|
9
|
-
UI.
|
9
|
+
UI.important("Fetching app access token")
|
10
10
|
|
11
11
|
uri = URI('https://connect-api.cloud.huawei.com/api/oauth2/v1/token')
|
12
12
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -33,10 +33,33 @@ module Fastlane
|
|
33
33
|
response = http.request(request)
|
34
34
|
|
35
35
|
result_json = JSON.parse(res.body)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.update_appinfo(client_id, token, app_id, privacy_policy_url)
|
39
|
+
UI.important("Updating app info")
|
40
|
+
|
41
|
+
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/app-info?appId=#{app_id}")
|
42
|
+
|
43
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
44
|
+
http.use_ssl = true
|
45
|
+
request = Net::HTTP::Put.new(uri.request_uri)
|
46
|
+
request["client_id"] = client_id
|
47
|
+
request["Authorization"] = "Bearer #{token}"
|
36
48
|
|
37
|
-
|
49
|
+
request.body = {privacyPolicy: privacy_policy_url}.to_json
|
50
|
+
|
51
|
+
response = http.request(request)
|
52
|
+
|
53
|
+
result_json = JSON.parse(response.body)
|
54
|
+
|
55
|
+
if result_json['ret']['code'] == 0
|
56
|
+
UI.success("Successfully updated app info")
|
57
|
+
else
|
58
|
+
UI.user_error!("Failed to update app info")
|
59
|
+
end
|
38
60
|
end
|
39
61
|
|
62
|
+
|
40
63
|
def self.upload_app(token, client_id, app_id, apk_path)
|
41
64
|
UI.message("Fetching upload URL")
|
42
65
|
|
@@ -47,15 +70,16 @@ module Fastlane
|
|
47
70
|
request = Net::HTTP::Get.new(uri.request_uri)
|
48
71
|
request["client_id"] = client_id
|
49
72
|
request["Authorization"] = "Bearer #{token}"
|
73
|
+
|
50
74
|
response = http.request(request)
|
51
75
|
|
52
76
|
result_json = JSON.parse(response.body)
|
53
77
|
|
54
78
|
if result_json['uploadUrl'].nil?
|
55
|
-
UI.
|
79
|
+
UI.user_error!('Cannot obtain upload url')
|
56
80
|
return false
|
57
81
|
else
|
58
|
-
UI.
|
82
|
+
UI.important('Uploading app')
|
59
83
|
# Upload App
|
60
84
|
boundary = "755754302457647"
|
61
85
|
uri = URI(result_json['uploadUrl'])
|
@@ -86,8 +110,8 @@ module Fastlane
|
|
86
110
|
result_json = JSON.parse(result.body)
|
87
111
|
|
88
112
|
if result_json['result']['result_code'].to_i == 0
|
89
|
-
UI.
|
90
|
-
UI.
|
113
|
+
UI.success('Upload app to AppGallery Connect successful')
|
114
|
+
UI.important("Saving app information")
|
91
115
|
|
92
116
|
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/app-file-info?appId=#{app_id}")
|
93
117
|
|
@@ -97,7 +121,7 @@ module Fastlane
|
|
97
121
|
request["client_id"] = client_id
|
98
122
|
request["Authorization"] = "Bearer #{token}"
|
99
123
|
|
100
|
-
data = {fileType: 5, lang:
|
124
|
+
data = {fileType: 5, lang: "en-GB", files: [{
|
101
125
|
|
102
126
|
fileName: "release.apk",
|
103
127
|
fileDestUrl: result_json['result']['UploadFileRsp']['fileInfoList'][0]['fileDestUlr'],
|
@@ -111,10 +135,10 @@ module Fastlane
|
|
111
135
|
result_json = JSON.parse(response.body)
|
112
136
|
|
113
137
|
if result_json['ret']['code'] == 0
|
114
|
-
UI.
|
138
|
+
UI.success("App information saved.")
|
115
139
|
return true
|
116
140
|
else
|
117
|
-
UI.
|
141
|
+
UI.user_error!("Failed to save app information")
|
118
142
|
return false
|
119
143
|
end
|
120
144
|
else
|
@@ -123,24 +147,68 @@ module Fastlane
|
|
123
147
|
end
|
124
148
|
end
|
125
149
|
|
126
|
-
def self.submit_app_for_review(token,
|
127
|
-
UI.
|
150
|
+
def self.submit_app_for_review(token, params)
|
151
|
+
UI.important("Submitting app for review")
|
152
|
+
|
153
|
+
release_type = ''
|
154
|
+
release_time = ''
|
155
|
+
|
156
|
+
if (params[:phase_wise_release] != nil && params[:phase_wise_release]) && (
|
157
|
+
params[:phase_release_start_time] == nil ||
|
158
|
+
params[:phase_release_end_time] == nil ||
|
159
|
+
params[:phase_release_percent] == nil ||
|
160
|
+
params[:phase_release_description] == nil
|
161
|
+
)
|
162
|
+
UI.user_error!("Submit for review failed. Phase wise release requires Start time, End time Release Percent & Descrption")
|
163
|
+
return
|
164
|
+
elsif params[:phase_wise_release] != nil && params[:phase_wise_release]
|
165
|
+
release_type = '&releaseType=3'
|
166
|
+
end
|
167
|
+
|
168
|
+
if params[:release_time] != nil
|
169
|
+
params[:release_time] = URI::encode(params[:release_time], /\W/)
|
170
|
+
release_time = "&releaseTime=#{params[:release_time]}"
|
171
|
+
end
|
172
|
+
|
173
|
+
changelog = ''
|
174
|
+
|
175
|
+
if params[:changelog_path] != nil
|
176
|
+
changelog_data = File.read(params[:changelog_path])
|
177
|
+
|
178
|
+
if changelog_data.length < 3 || changelog_data.length > 300
|
179
|
+
UI.user_error!("Failed to submit app for review. Changelog file length is invalid")
|
180
|
+
return
|
181
|
+
else
|
182
|
+
changelog = "&remark=" + URI::encode(changelog_data)
|
183
|
+
end
|
184
|
+
end
|
128
185
|
|
129
|
-
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/app-submit?appId=#{app_id}")
|
186
|
+
uri = URI.parse("https://connect-api.cloud.huawei.com/api/publish/v2/app-submit?appId=#{params[:app_id]}" + changelog + release_type + release_time)
|
130
187
|
|
131
188
|
http = Net::HTTP.new(uri.host, uri.port)
|
132
189
|
http.use_ssl = true
|
133
190
|
request = Net::HTTP::Post.new(uri.request_uri)
|
134
|
-
request["client_id"] = client_id
|
191
|
+
request["client_id"] = params[:client_id]
|
135
192
|
request["Authorization"] = "Bearer #{token}"
|
193
|
+
|
194
|
+
if params[:phase_wise_release] != nil && params[:phase_wise_release]
|
195
|
+
request.body = {
|
196
|
+
phasedReleaseStartTime: params[:phase_release_start_time],
|
197
|
+
phasedReleaseEndTime: params[:phase_release_end_time],
|
198
|
+
phasedReleasePercent: params[:phase_release_percent],
|
199
|
+
phasedReleaseDescription: params[:phase_release_description]
|
200
|
+
}.to_json
|
201
|
+
end
|
202
|
+
|
203
|
+
|
136
204
|
response = http.request(request)
|
137
205
|
|
138
206
|
result_json = JSON.parse(response.body)
|
139
207
|
|
140
208
|
if result_json['ret']['code'] == 0
|
141
|
-
UI.
|
209
|
+
UI.success("Successfully submitted app for review")
|
142
210
|
else
|
143
|
-
UI.
|
211
|
+
UI.user_error!("Failed to submit app for review")
|
144
212
|
end
|
145
213
|
|
146
214
|
end
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shreejan Shrestha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|