Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca061d798d | ||
|
|
21e00b9d69 | ||
|
|
e9a4446395 | ||
|
|
b06f374506 | ||
|
|
84d17e8c1c | ||
|
|
40448bb1bb |
10
README.md
10
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
|
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`
|
||||||
|
|
||||||
|
|||||||
32
lib/edits.js
32
lib/edits.js
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -40,21 +40,30 @@ 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
|
||||||
|
core.info(`Creating a new Edit for this release`);
|
||||||
const appEdit = yield androidPublisher.edits.insert({
|
const appEdit = yield androidPublisher.edits.insert({
|
||||||
auth: options.auth,
|
auth: options.auth,
|
||||||
packageName: options.applicationId
|
packageName: options.applicationId
|
||||||
});
|
});
|
||||||
// Validate the given track
|
// Validate the given track
|
||||||
|
core.info(`Validating track '${options.track}'`);
|
||||||
yield validateSelectedTrack(appEdit.data, options).catch(reason => {
|
yield validateSelectedTrack(appEdit.data, options).catch(reason => {
|
||||||
core.setFailed(reason);
|
core.setFailed(reason);
|
||||||
return Promise.reject(reason);
|
return Promise.reject(reason);
|
||||||
@@ -62,14 +71,16 @@ function uploadToPlayStore(options, releaseFiles) {
|
|||||||
// Upload artifacts to Google Play, and store their version codes
|
// Upload artifacts to Google Play, and store their version codes
|
||||||
const versionCodes = new Array();
|
const versionCodes = new Array();
|
||||||
for (const releaseFile of releaseFiles) {
|
for (const releaseFile of releaseFiles) {
|
||||||
core.debug(`Uploading ${releaseFile}`);
|
core.info(`Uploading ${releaseFile}`);
|
||||||
const versionCode = yield uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
|
const versionCode = yield uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
|
||||||
core.setFailed(reason);
|
core.setFailed(reason);
|
||||||
return Promise.reject(reason);
|
return Promise.reject(reason);
|
||||||
});
|
});
|
||||||
versionCodes.push(versionCode);
|
versionCodes.push(versionCode);
|
||||||
}
|
}
|
||||||
|
core.info(`Successfully uploaded ${versionCodes.length} artifacts`);
|
||||||
// Add the uploaded artifacts to the Edit track
|
// Add the uploaded artifacts to the Edit track
|
||||||
|
core.info(`Adding ${versionCodes.length} artifacts to release on '${options.track}' track`);
|
||||||
const track = yield addReleasesToTrack(appEdit.data, options, versionCodes);
|
const track = yield addReleasesToTrack(appEdit.data, options, versionCodes);
|
||||||
core.debug(`Track: ${track}`);
|
core.debug(`Track: ${track}`);
|
||||||
// Extract the release name for the response
|
// Extract the release name for the response
|
||||||
@@ -79,7 +90,11 @@ function uploadToPlayStore(options, releaseFiles) {
|
|||||||
trackReleaseName = trackRelease.name;
|
trackReleaseName = trackRelease.name;
|
||||||
core.debug(`Pulled track release name from update: ${trackReleaseName}`);
|
core.debug(`Pulled track release name from update: ${trackReleaseName}`);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
core.debug(`Didn't find any releases on the track`);
|
||||||
|
}
|
||||||
// Commit the pending Edit
|
// Commit the pending Edit
|
||||||
|
core.info(`Committing the Edit`);
|
||||||
const res = yield androidPublisher.edits.commit({
|
const res = yield androidPublisher.edits.commit({
|
||||||
auth: options.auth,
|
auth: options.auth,
|
||||||
editId: appEdit.data.id,
|
editId: appEdit.data.id,
|
||||||
@@ -89,6 +104,7 @@ function uploadToPlayStore(options, releaseFiles) {
|
|||||||
if (res.data.id != null) {
|
if (res.data.id != null) {
|
||||||
core.debug(`Successfully committed ${res.data.id}`);
|
core.debug(`Successfully committed ${res.data.id}`);
|
||||||
const name = options.name || trackReleaseName;
|
const name = options.name || trackReleaseName;
|
||||||
|
core.info(`Successfully committed release ${name}`);
|
||||||
if (name) {
|
if (name) {
|
||||||
core.setOutput("releaseName", name);
|
core.setOutput("releaseName", name);
|
||||||
}
|
}
|
||||||
@@ -109,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|||||||
29
src/edits.ts
29
src/edits.ts
@@ -33,21 +33,30 @@ 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`)
|
||||||
const appEdit = await androidPublisher.edits.insert({
|
const appEdit = await androidPublisher.edits.insert({
|
||||||
auth: options.auth,
|
auth: options.auth,
|
||||||
packageName: options.applicationId
|
packageName: options.applicationId
|
||||||
});
|
});
|
||||||
|
|
||||||
// Validate the given track
|
// Validate the given track
|
||||||
|
core.info(`Validating track '${options.track}'`)
|
||||||
await validateSelectedTrack(appEdit.data, options).catch(reason => {
|
await validateSelectedTrack(appEdit.data, options).catch(reason => {
|
||||||
core.setFailed(reason);
|
core.setFailed(reason);
|
||||||
return Promise.reject(reason);
|
return Promise.reject(reason);
|
||||||
@@ -56,15 +65,17 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
|||||||
// Upload artifacts to Google Play, and store their version codes
|
// Upload artifacts to Google Play, and store their version codes
|
||||||
const versionCodes = new Array<number>();
|
const versionCodes = new Array<number>();
|
||||||
for (const releaseFile of releaseFiles) {
|
for (const releaseFile of releaseFiles) {
|
||||||
core.debug(`Uploading ${releaseFile}`);
|
core.info(`Uploading ${releaseFile}`);
|
||||||
const versionCode = await uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
|
const versionCode = await uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
|
||||||
core.setFailed(reason);
|
core.setFailed(reason);
|
||||||
return Promise.reject(reason);
|
return Promise.reject(reason);
|
||||||
});
|
});
|
||||||
versionCodes.push(versionCode!);
|
versionCodes.push(versionCode!);
|
||||||
}
|
}
|
||||||
|
core.info(`Successfully uploaded ${versionCodes.length} artifacts`)
|
||||||
|
|
||||||
// Add the uploaded artifacts to the Edit track
|
// Add the uploaded artifacts to the Edit track
|
||||||
|
core.info(`Adding ${versionCodes.length} artifacts to release on '${options.track}' track`)
|
||||||
const track = await addReleasesToTrack(appEdit.data, options, versionCodes);
|
const track = await addReleasesToTrack(appEdit.data, options, versionCodes);
|
||||||
core.debug(`Track: ${track}`);
|
core.debug(`Track: ${track}`);
|
||||||
|
|
||||||
@@ -74,9 +85,12 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
|||||||
const trackRelease = track.releases[0];
|
const trackRelease = track.releases[0];
|
||||||
trackReleaseName = trackRelease.name;
|
trackReleaseName = trackRelease.name;
|
||||||
core.debug(`Pulled track release name from update: ${trackReleaseName}`)
|
core.debug(`Pulled track release name from update: ${trackReleaseName}`)
|
||||||
|
} else {
|
||||||
|
core.debug(`Didn't find any releases on the track`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit the pending Edit
|
// Commit the pending Edit
|
||||||
|
core.info(`Committing the Edit`)
|
||||||
const res = await androidPublisher.edits.commit({
|
const res = await androidPublisher.edits.commit({
|
||||||
auth: options.auth,
|
auth: options.auth,
|
||||||
editId: appEdit.data.id!,
|
editId: appEdit.data.id!,
|
||||||
@@ -87,6 +101,7 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
|||||||
if (res.data.id != null) {
|
if (res.data.id != null) {
|
||||||
core.debug(`Successfully committed ${res.data.id}`);
|
core.debug(`Successfully committed ${res.data.id}`);
|
||||||
const name = options.name || trackReleaseName;
|
const name = options.name || trackReleaseName;
|
||||||
|
core.info(`Successfully committed release ${name}`)
|
||||||
if (name) {
|
if (name) {
|
||||||
core.setOutput("releaseName", name);
|
core.setOutput("releaseName", name);
|
||||||
} else {
|
} else {
|
||||||
@@ -103,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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user