From b06f374506d634dab31f38ea863ed49512d82665 Mon Sep 17 00:00:00 2001 From: Riccardo Lattarulo Date: Tue, 22 Dec 2020 16:57:37 +0100 Subject: [PATCH 1/3] Add internal sharing download url to output --- lib/edits.js | 4 ++++ src/edits.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/edits.js b/lib/edits.js index e049cde2..eb752645 100644 --- a/lib/edits.js +++ b/lib/edits.js @@ -118,11 +118,15 @@ function uploadInternalSharingRelease(options, releaseFile) { return __awaiter(this, void 0, void 0, function* () { if (releaseFile.endsWith('.apk')) { const res = yield internalSharingUploadApk(options, releaseFile); + core.setOutput("internalSharingDownloadUrl", res.downloadUrl); + core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URL", res.downloadUrl); console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`); return Promise.resolve(res.downloadUrl); } else if (releaseFile.endsWith('.aab')) { const res = yield internalSharingUploadBundle(options, releaseFile); + core.setOutput("internalSharingDownloadUrl", res.downloadUrl); + core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URL", res.downloadUrl); console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`); return Promise.resolve(res.downloadUrl); } diff --git a/src/edits.ts b/src/edits.ts index ecce9e2f..a7947107 100644 --- a/src/edits.ts +++ b/src/edits.ts @@ -111,10 +111,14 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri async function uploadInternalSharingRelease(options: EditOptions, releaseFile: string): Promise { if (releaseFile.endsWith('.apk')) { const res = await internalSharingUploadApk(options, releaseFile) + core.setOutput("internalSharingDownloadUrl", res.downloadUrl); + core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URL", res.downloadUrl); console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`) return Promise.resolve(res.downloadUrl) } else if (releaseFile.endsWith('.aab')) { const res = await internalSharingUploadBundle(options, releaseFile) + core.setOutput("internalSharingDownloadUrl", res.downloadUrl); + core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URL", res.downloadUrl); console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`) return Promise.resolve(res.downloadUrl) } else { From e9a4446395ac7f66586642fa59891ced3451e3fe Mon Sep 17 00:00:00 2001 From: Riccardo Lattarulo Date: Wed, 23 Dec 2020 10:16:35 +0100 Subject: [PATCH 2/3] Add multiple urls to internal sharing outputs --- lib/edits.js | 15 +++++++++++---- src/edits.ts | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/edits.js b/lib/edits.js index eb752645..4c426942 100644 --- a/lib/edits.js +++ b/lib/edits.js @@ -40,13 +40,20 @@ function uploadToPlayStore(options, releaseFiles) { // 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"); + let downloadUrls = [] for (const releaseFile of releaseFiles) { core.debug(`Uploading ${releaseFile}`); - yield uploadInternalSharingRelease(options, releaseFile).catch(reason => { - core.setFailed(reason); - return Promise.reject(reason); - }); + yield uploadInternalSharingRelease(options, releaseFile) + .then(downloadUrl => { + downloadUrls.push(downloadUrl) + }) + .catch(reason => { + core.setFailed(reason); + return Promise.reject(reason); + }); } + core.setOutput("internalSharingDownloadUrls", downloadUrls); + core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URLS", downloadUrls); } else { // Create a new Edit diff --git a/src/edits.ts b/src/edits.ts index a7947107..bc21357b 100644 --- a/src/edits.ts +++ b/src/edits.ts @@ -33,13 +33,20 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri // 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") + let downloadUrls: string[] = [] for (const releaseFile of releaseFiles) { core.debug(`Uploading ${releaseFile}`); - await uploadInternalSharingRelease(options, releaseFile).catch(reason => { - core.setFailed(reason); - return Promise.reject(reason); - }); + await uploadInternalSharingRelease(options, releaseFile) + .then(downloadUrl => { + downloadUrls.push(downloadUrl as string) + }) + .catch(reason => { + core.setFailed(reason); + return Promise.reject(reason); + }); } + core.setOutput("internalSharingDownloadUrls", downloadUrls); + core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URLS", downloadUrls); } else { // Create a new Edit core.info(`Creating a new Edit for this release`) From 21e00b9d694fb1914a407c1accd52a8b3d002177 Mon Sep 17 00:00:00 2001 From: Riccardo Lattarulo Date: Tue, 29 Dec 2020 17:39:10 +0100 Subject: [PATCH 3/3] Update documentation to address the addition of multiple urls as output for internal sharing --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b378bf13..bbcd12d6 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,17 @@ The mapping.txt file used to de-obfuscate your stack traces from crash reports The name of the release published to Google Play, which is generated on commit by default +### `internalSharingDownloadUrls` + +A JSON list containing the download urls for every release file uploaded using the `track` `internalsharing` + +### ENV VAR: `INTERNAL_SHARING_DOWNLOAD_URLS` + +The environment variable that is set when using the `track` `internalsharing` + ### `internalSharingDownloadUrl` -The download url for an app that was uploaded using the `track` `internalsharing` +The download url for the last release file uploaded using the `track` `internalsharing`, useful when a single release file is uploaded ### ENV VAR: `INTERNAL_SHARING_DOWNLOAD_URL`