feature: Add support for App Bundle Explorer's Internal app sharing link. (#166)

Updated json5 dependency to patch vulnerability.
This commit is contained in:
Shi Chen
2023-01-12 21:55:12 -06:00
committed by GitHub
parent 8a353d6e46
commit cd131e853c
2 changed files with 23 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -75,17 +75,16 @@ export async function runUpload(
}
async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]): Promise<string | void> {
const internalSharingDownloadUrls: string[] = []
// 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")
const downloadUrls: string[] = []
for (const releaseFile of releaseFiles) {
core.debug(`Uploading ${releaseFile}`);
const url = await uploadInternalSharingRelease(options, releaseFile)
downloadUrls.push(url)
internalSharingDownloadUrls.push(url)
}
core.setOutput("internalSharingDownloadUrls", downloadUrls);
core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URLS", downloadUrls);
} else {
// Create a new Edit
const appEditId = await getOrCreateEdit(options)
@@ -96,6 +95,14 @@ async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]):
// Upload artifacts to Google Play, and store their version codes
const versionCodes = await uploadReleaseFiles(appEditId, options, releaseFiles)
// Infer the download URL from the version codes
for (const versionCode of versionCodes) {
const url = inferInternalSharingDownloadUrl(options.applicationId, versionCode);
core.setOutput("internalSharingDownloadUrl", url);
core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URL", url);
internalSharingDownloadUrls.push(url);
}
// Add the uploaded artifacts to the Edit track
await addReleasesToTrack(appEditId, options, versionCodes);
@@ -117,6 +124,9 @@ async function uploadToPlayStore(options: EditOptions, releaseFiles: string[]):
return Promise.reject(res.status);
}
}
core.setOutput("internalSharingDownloadUrls", internalSharingDownloadUrls);
core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URLS", internalSharingDownloadUrls);
}
async function uploadInternalSharingRelease(options: EditOptions, releaseFile: string): Promise<string> {
@@ -398,3 +408,10 @@ async function uploadReleaseFiles(appEditId: string, options: EditOptions, relea
return versionCodes
}
function inferInternalSharingDownloadUrl(
applicationId: string,
versionCode: number
) {
return `https://play.google.com/apps/test/${applicationId}/${versionCode}`;
}