Merge pull request #53 from lriccardo/master

Add internal sharing download url to outputs and env
This commit is contained in:
Drew Heavner
2020-12-30 15:29:09 -05:00
committed by GitHub
3 changed files with 39 additions and 9 deletions

View File

@@ -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 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` ### `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` ### ENV VAR: `INTERNAL_SHARING_DOWNLOAD_URL`

View File

@@ -40,13 +40,20 @@ function uploadToPlayStore(options, releaseFiles) {
// Check the 'track' for 'internalsharing', if so switch to a non-track api // Check the 'track' for 'internalsharing', if so switch to a non-track api
if (options.track === 'internalsharing') { if (options.track === 'internalsharing') {
core.debug("Track is Internal app sharing, switch to special upload api"); core.debug("Track is Internal app sharing, switch to special upload api");
let downloadUrls = []
for (const releaseFile of releaseFiles) { for (const releaseFile of releaseFiles) {
core.debug(`Uploading ${releaseFile}`); core.debug(`Uploading ${releaseFile}`);
yield uploadInternalSharingRelease(options, releaseFile).catch(reason => { yield uploadInternalSharingRelease(options, releaseFile)
core.setFailed(reason); .then(downloadUrl => {
return Promise.reject(reason); downloadUrls.push(downloadUrl)
}); })
.catch(reason => {
core.setFailed(reason);
return Promise.reject(reason);
});
} }
core.setOutput("internalSharingDownloadUrls", downloadUrls);
core.exportVariable("INTERNAL_SHARING_DOWNLOAD_URLS", downloadUrls);
} }
else { else {
// Create a new Edit // Create a new Edit
@@ -118,11 +125,15 @@ function uploadInternalSharingRelease(options, releaseFile) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (releaseFile.endsWith('.apk')) { if (releaseFile.endsWith('.apk')) {
const res = yield internalSharingUploadApk(options, releaseFile); 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}`); console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`);
return Promise.resolve(res.downloadUrl); return Promise.resolve(res.downloadUrl);
} }
else if (releaseFile.endsWith('.aab')) { else if (releaseFile.endsWith('.aab')) {
const res = yield internalSharingUploadBundle(options, releaseFile); 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}`); console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`);
return Promise.resolve(res.downloadUrl); return Promise.resolve(res.downloadUrl);
} }

View File

@@ -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 // Check the 'track' for 'internalsharing', if so switch to a non-track api
if (options.track === 'internalsharing') { if (options.track === 'internalsharing') {
core.debug("Track is Internal app sharing, switch to special upload api") core.debug("Track is Internal app sharing, switch to special upload api")
let downloadUrls: string[] = []
for (const releaseFile of releaseFiles) { for (const releaseFile of releaseFiles) {
core.debug(`Uploading ${releaseFile}`); core.debug(`Uploading ${releaseFile}`);
await uploadInternalSharingRelease(options, releaseFile).catch(reason => { await uploadInternalSharingRelease(options, releaseFile)
core.setFailed(reason); .then(downloadUrl => {
return Promise.reject(reason); 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 { } else {
// Create a new Edit // Create a new Edit
core.info(`Creating a new Edit for this release`) core.info(`Creating a new Edit for this release`)
@@ -111,10 +118,14 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
async function uploadInternalSharingRelease(options: EditOptions, releaseFile: string): Promise<string | undefined | null> { async function uploadInternalSharingRelease(options: EditOptions, releaseFile: string): Promise<string | undefined | null> {
if (releaseFile.endsWith('.apk')) { if (releaseFile.endsWith('.apk')) {
const res = await internalSharingUploadApk(options, releaseFile) 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}`) console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`)
return Promise.resolve(res.downloadUrl) return Promise.resolve(res.downloadUrl)
} else if (releaseFile.endsWith('.aab')) { } else if (releaseFile.endsWith('.aab')) {
const res = await internalSharingUploadBundle(options, releaseFile) 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}`) console.log(`${releaseFile} uploaded to Internal Sharing, download it with ${res.downloadUrl}`)
return Promise.resolve(res.downloadUrl) return Promise.resolve(res.downloadUrl)
} else { } else {