Add some output for the user to read while the action is running
This commit is contained in:
13
lib/edits.js
13
lib/edits.js
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
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);
|
||||
return result;
|
||||
};
|
||||
@@ -50,11 +50,13 @@ function uploadToPlayStore(options, releaseFiles) {
|
||||
}
|
||||
else {
|
||||
// Create a new Edit
|
||||
core.info(`Creating a new Edit for this release`);
|
||||
const appEdit = yield androidPublisher.edits.insert({
|
||||
auth: options.auth,
|
||||
packageName: options.applicationId
|
||||
});
|
||||
// Validate the given track
|
||||
core.info(`Validating track '${options.track}'`);
|
||||
yield validateSelectedTrack(appEdit.data, options).catch(reason => {
|
||||
core.setFailed(reason);
|
||||
return Promise.reject(reason);
|
||||
@@ -62,14 +64,16 @@ function uploadToPlayStore(options, releaseFiles) {
|
||||
// Upload artifacts to Google Play, and store their version codes
|
||||
const versionCodes = new Array();
|
||||
for (const releaseFile of releaseFiles) {
|
||||
core.debug(`Uploading ${releaseFile}`);
|
||||
core.info(`Uploading ${releaseFile}`);
|
||||
const versionCode = yield uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
|
||||
core.setFailed(reason);
|
||||
return Promise.reject(reason);
|
||||
});
|
||||
versionCodes.push(versionCode);
|
||||
}
|
||||
core.info(`Successfully uploaded ${versionCodes.length} artifacts`);
|
||||
// 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);
|
||||
core.debug(`Track: ${track}`);
|
||||
// Extract the release name for the response
|
||||
@@ -79,7 +83,11 @@ function uploadToPlayStore(options, releaseFiles) {
|
||||
trackReleaseName = trackRelease.name;
|
||||
core.debug(`Pulled track release name from update: ${trackReleaseName}`);
|
||||
}
|
||||
else {
|
||||
core.debug(`Didn't find any releases on the track`);
|
||||
}
|
||||
// Commit the pending Edit
|
||||
core.info(`Committing the Edit`);
|
||||
const res = yield androidPublisher.edits.commit({
|
||||
auth: options.auth,
|
||||
editId: appEdit.data.id,
|
||||
@@ -89,6 +97,7 @@ function uploadToPlayStore(options, releaseFiles) {
|
||||
if (res.data.id != null) {
|
||||
core.debug(`Successfully committed ${res.data.id}`);
|
||||
const name = options.name || trackReleaseName;
|
||||
core.info(`Successfully committed release ${name}`);
|
||||
if (name) {
|
||||
core.setOutput("releaseName", name);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
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);
|
||||
return result;
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
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);
|
||||
return result;
|
||||
};
|
||||
|
||||
10
src/edits.ts
10
src/edits.ts
@@ -42,12 +42,14 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
||||
}
|
||||
} else {
|
||||
// Create a new Edit
|
||||
core.info(`Creating a new Edit for this release`)
|
||||
const appEdit = await androidPublisher.edits.insert({
|
||||
auth: options.auth,
|
||||
packageName: options.applicationId
|
||||
});
|
||||
|
||||
// Validate the given track
|
||||
core.info(`Validating track '${options.track}'`)
|
||||
await validateSelectedTrack(appEdit.data, options).catch(reason => {
|
||||
core.setFailed(reason);
|
||||
return Promise.reject(reason);
|
||||
@@ -56,15 +58,17 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
||||
// Upload artifacts to Google Play, and store their version codes
|
||||
const versionCodes = new Array<number>();
|
||||
for (const releaseFile of releaseFiles) {
|
||||
core.debug(`Uploading ${releaseFile}`);
|
||||
core.info(`Uploading ${releaseFile}`);
|
||||
const versionCode = await uploadRelease(appEdit.data, options, releaseFile).catch(reason => {
|
||||
core.setFailed(reason);
|
||||
return Promise.reject(reason);
|
||||
});
|
||||
versionCodes.push(versionCode!);
|
||||
}
|
||||
core.info(`Successfully uploaded ${versionCodes.length} artifacts`)
|
||||
|
||||
// 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);
|
||||
core.debug(`Track: ${track}`);
|
||||
|
||||
@@ -74,9 +78,12 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
||||
const trackRelease = track.releases[0];
|
||||
trackReleaseName = trackRelease.name;
|
||||
core.debug(`Pulled track release name from update: ${trackReleaseName}`)
|
||||
} else {
|
||||
core.debug(`Didn't find any releases on the track`)
|
||||
}
|
||||
|
||||
// Commit the pending Edit
|
||||
core.info(`Committing the Edit`)
|
||||
const res = await androidPublisher.edits.commit({
|
||||
auth: options.auth,
|
||||
editId: appEdit.data.id!,
|
||||
@@ -87,6 +94,7 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
|
||||
if (res.data.id != null) {
|
||||
core.debug(`Successfully committed ${res.data.id}`);
|
||||
const name = options.name || trackReleaseName;
|
||||
core.info(`Successfully committed release ${name}`)
|
||||
if (name) {
|
||||
core.setOutput("releaseName", name);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user