Updating changes from remote. Adding compiled .js files to git.

This commit is contained in:
Drew Heavner
2020-10-09 14:12:33 +00:00
committed by GitHub
5 changed files with 112 additions and 5 deletions

View File

@@ -24,6 +24,21 @@ const whatsnew_1 = require("./whatsnew");
const androidPublisher = googleapis_1.google.androidpublisher('v3');
function uploadRelease(options, releaseFile) {
return __awaiter(this, void 0, void 0, function* () {
// Check the 'track' for 'internalsharing', if so switch to a non-track api
if (options.track === 'internalsharing') {
core.debug("Track is Internal app sharing, switch to special upload api");
if (releaseFile.endsWith('.apk')) {
const res = yield internalSharingUploadApk(options, releaseFile);
return Promise.resolve(res.downloadUrl);
}
else if (releaseFile.endsWith('.aab')) {
const res = yield internalSharingUploadBundle(options, releaseFile);
return Promise.resolve(res.downloadUrl);
}
else {
return Promise.reject(`Unrecognized Release File`);
}
}
const appEdit = yield androidPublisher.edits.insert({
auth: options.auth,
packageName: options.applicationId
@@ -122,6 +137,34 @@ function uploadMappingFile(appEdit, versionCode, options) {
}
});
}
function internalSharingUploadApk(options, apkReleaseFile) {
return __awaiter(this, void 0, void 0, function* () {
core.debug(`[packageName=${options.applicationId}]: Uploading Internal Sharing APK @ ${apkReleaseFile}`);
const res = yield androidPublisher.internalappsharingartifacts.uploadapk({
auth: options.auth,
packageName: options.applicationId,
media: {
mimeType: 'application/vnd.android.package-archive',
body: fs.createReadStream(apkReleaseFile)
}
});
return res.data;
});
}
function internalSharingUploadBundle(options, bundleReleaseFile) {
return __awaiter(this, void 0, void 0, function* () {
core.debug(`[packageName=${options.applicationId}]: Uploading Internal Sharing Bundle @ ${bundleReleaseFile}`);
const res = yield androidPublisher.internalappsharingartifacts.uploadbundle({
auth: options.auth,
packageName: options.applicationId,
media: {
mimeType: 'application/octet-stream',
body: fs.createReadStream(bundleReleaseFile)
}
});
return res.data;
});
}
function uploadApk(appEdit, options, apkReleaseFile) {
return __awaiter(this, void 0, void 0, function* () {
core.debug(`[${appEdit.id}, packageName=${options.applicationId}]: Uploading APK @ ${apkReleaseFile}`);