Skip to content

Commit 6e540e3

Browse files
committed
Do not submit Huawei AppGallery when only draft is needed
1 parent 9bc307f commit 6e540e3

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

‎main.js‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ async function submitHuaweiAppUpdate (accessToken) {
15531553
}
15541554
}
15551555

1556-
function uploadToHuaweiAppGallery (task, build, onDone) {
1556+
function uploadToHuaweiAppGallery (task, build, onDone, draftOnly) {
15571557
(async () => {
15581558
const targetFiles = build.files['huawei'] || build.files['universal'];
15591559
// Step 1. Obtain access_token
@@ -1617,12 +1617,14 @@ function uploadToHuaweiAppGallery (task, build, onDone) {
16171617
}
16181618

16191619
// Step 6. Submit for review
1620-
const submittedApp = await submitHuaweiAppUpdate(
1621-
auth.access_token
1622-
);
1623-
if (!submittedApp) {
1624-
onDone(1);
1625-
return;
1620+
if (!draftOnly) {
1621+
const submittedApp = await submitHuaweiAppUpdate(
1622+
auth.access_token
1623+
);
1624+
if (!submittedApp) {
1625+
onDone(1);
1626+
return;
1627+
}
16261628
}
16271629

16281630
console.log('Successfully published Huawei AppGallery');
@@ -1638,7 +1640,7 @@ function uploadToHuaweiAppGallery (task, build, onDone) {
16381640
};
16391641
}
16401642

1641-
function uploadToGithub (task, build, onDone) {
1643+
function uploadToGithub (task, build, onDone, draftOnly) {
16421644
// TODO:
16431645
// 1. Delete previous beta, if it was published
16441646
// 2. Publish WIP/stable release
@@ -2396,6 +2398,8 @@ function processPrivateCommand (botId, bot, msg, command, commandArgsRaw) {
23962398
}
23972399

23982400
if (!LOCAL && (build.googlePlayTrack || build.huaweiTrack || build.githubTrack)) {
2401+
const draftOnly = build.googlePlayTrack === 'production';
2402+
23992403
build.tasks.push({
24002404
name: 'prepareForPublishing',
24012405
needsAwait: true,
@@ -2405,7 +2409,7 @@ function processPrivateCommand (botId, bot, msg, command, commandArgsRaw) {
24052409
});
24062410

24072411
if (build.googlePlayTrack) {
2408-
const uploadTaskSuffix = ucfirst(build.googlePlayTrack) + (build.googlePlayTrack === 'production' ? 'Draft' : '');
2412+
const uploadTaskSuffix = ucfirst(build.googlePlayTrack) + (draftOnly ? 'Draft' : '');
24092413
build.tasks.push({
24102414
name: 'publishGooglePlay' + uploadTaskSuffix,
24112415
isAsync: true,
@@ -2416,23 +2420,23 @@ function processPrivateCommand (botId, bot, msg, command, commandArgsRaw) {
24162420
}
24172421

24182422
if (build.huaweiTrack) {
2419-
const uploadTaskSuffix = build.huaweiTrack !== 'production' ? ucfirst(build.huaweiTrack) : '';
2423+
const uploadTaskSuffix = (build.huaweiTrack !== 'production' ? ucfirst(build.huaweiTrack) : '') + (draftOnly ? 'Draft' : '');
24202424
build.tasks.push({
24212425
name: 'publishHuaweiAppGallery' + uploadTaskSuffix,
24222426
isAsync: true,
24232427
act: (task, callback) => {
2424-
return uploadToHuaweiAppGallery(task, build, callback);
2428+
return uploadToHuaweiAppGallery(task, build, callback, draftOnly);
24252429
}
24262430
})
24272431
}
24282432

24292433
if (build.githubTrack) {
2430-
const uploadTaskSuffix = build.githubTrack !== 'production' ? ucfirst(build.githubTrack) : '';
2434+
const uploadTaskSuffix = (build.githubTrack !== 'production' ? ucfirst(build.githubTrack) : '') + (draftOnly ? 'Draft' : '');
24312435
build.tasks.push({
24322436
name: 'publishGithub' + uploadTaskSuffix,
24332437
isAsync: true,
24342438
act: (task, callback) => {
2435-
return uploadToGithub(task, build, callback);
2439+
return uploadToGithub(task, build, callback, draftOnly);
24362440
}
24372441
});
24382442
}

0 commit comments

Comments
 (0)