Skip to content

Commit

Permalink
Merge pull request #43 from boswelja/output-release-name
Browse files Browse the repository at this point in the history
Output published release name on success
  • Loading branch information
r0adkll authored Dec 1, 2020
2 parents 3ea191f + 373fb32 commit a899564
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
13 changes: 12 additions & 1 deletion lib/edits.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -80,6 +80,7 @@ function uploadToPlayStore(options, releaseFiles) {
// Simple check to see whether commit was successful
if (res.data.id != null) {
core.debug(`Successfully committed ${res.data.id}`);
core.setOutput("releaseName", getPublishedReleaseName(res.data, options));
return Promise.resolve(res.data.id);
}
else {
Expand Down Expand Up @@ -249,3 +250,13 @@ function uploadBundle(appEdit, options, bundleReleaseFile) {
return res.data;
});
}
function getPublishedReleaseName(appEdit, options) {
return __awaiter(this, void 0, void 0, function* () {
const track = yield androidPublisher.edits.tracks.get({
editId: appEdit.id,
track: options.track
});
const release = track.data.releases[0]; // We only ever create one release, so grab the first one
return release.name;
});
}
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/whatsnew.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
10 changes: 10 additions & 0 deletions src/edits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export async function uploadToPlayStore(options: EditOptions, releaseFiles: stri
// Simple check to see whether commit was successful
if (res.data.id != null) {
core.debug(`Successfully committed ${res.data.id}`);
core.setOutput("releaseName", getPublishedReleaseName(res.data, options))
return Promise.resolve(res.data.id!);
} else {
core.setFailed(`Error ${res.status}: ${res.statusText}`);
Expand Down Expand Up @@ -238,3 +239,12 @@ async function uploadBundle(appEdit: AppEdit, options: EditOptions, bundleReleas

return res.data
}

async function getPublishedReleaseName(appEdit: AppEdit, options: EditOptions): Promise<String | null | undefined> {
const track = await androidPublisher.edits.tracks.get({
editId: appEdit.id!,
track: options.track
})
const release = track.data.releases![0] // We only ever create one release, so grab the first one
return release.name
}

0 comments on commit a899564

Please sign in to comment.