Skip to content

Commit

Permalink
Add not required release name input
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatyana Kostromskaya (Akvelon INC) committed Aug 5, 2021
1 parent c66a371 commit 27b2dc5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Tasks/GooglePlayReleaseBundle/GooglePlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async function run() {
versionCodeFilter = tl.getInput('replaceExpression', true);
}

const releaseName: string = tl.getInput('releaseName', false);
const track: string = tl.getInput('track', true);
const userFractionSupplied: boolean = tl.getBoolInput('rolloutToUserFraction');
const userFraction: number = Number(userFractionSupplied ? tl.getInput('userFraction', false) : 1.0);
Expand Down Expand Up @@ -132,7 +133,7 @@ async function run() {

console.log(tl.loc('UpdateTrack'));
tl.debug(`Updating the track ${track}.`);
const updatedTrack: pub3.Schema$Track = await updateTrack(edits, packageName, track, '' + bundleVersionCode, versionCodeFilterType, versionCodeFilter, userFraction, updatePriority, releaseNotes);
const updatedTrack: pub3.Schema$Track = await updateTrack(edits, packageName, track, '' + bundleVersionCode, versionCodeFilterType, versionCodeFilter, userFraction, updatePriority, releaseNotes, releaseName);
tl.debug('Updated track info: ' + JSON.stringify(updatedTrack));

tl.debug('Committing the edit transaction in Google Play.');
Expand Down Expand Up @@ -173,7 +174,8 @@ async function updateTrack(
versionCodeFilter: string | string[],
userFraction: number,
updatePriority: number,
releaseNotes?: pub3.Schema$LocalizedText[]): Promise<pub3.Schema$Track> {
releaseNotes?: pub3.Schema$LocalizedText[],
releaseName?: string): Promise<pub3.Schema$Track> {

let newTrackVersionCodes: string[] = [];
let res: pub3.Schema$Track;
Expand Down Expand Up @@ -220,7 +222,7 @@ async function updateTrack(

tl.debug(`New ${track} track version codes: ` + JSON.stringify(newTrackVersionCodes));
try {
res = await googleutil.updateTrack(edits, packageName, track, newTrackVersionCodes, userFraction, updatePriority, releaseNotes);
res = await googleutil.updateTrack(edits, packageName, track, newTrackVersionCodes, userFraction, updatePriority, releaseNotes, releaseName);
} catch (e) {
tl.debug(`Failed to update track ${track}.`);
tl.debug(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"loc.input.help.shouldUploadMappingFile": "Select this option to attach your proguard mapping.txt file to the primary APK.",
"loc.input.label.mappingFilePath": "Deobfuscation path",
"loc.input.help.mappingFilePath": "The path to the proguard mapping.txt file to upload.",
"loc.input.label.releaseName": "Release name",
"loc.input.help.releaseName": "The release name is only for use in Play Console and won't be visible to users. To make your release easier to identify, add a release name that's meaningful to you.",
"loc.input.label.versionCodeFilterType": "Replace version codes",
"loc.input.help.versionCodeFilterType": "Specify version codes to replace in the selected track with the new APKs: all, the comma separated list, or a regular expression pattern.",
"loc.input.label.replaceList": "Version code list",
Expand Down
7 changes: 6 additions & 1 deletion Tasks/GooglePlayReleaseBundle/googleutil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,18 @@ export async function getTrack(edits: pub3.Resource$Edits, packageName: string,
* @returns {Promise} track - A promise that will return result from updating a track
* { track: string, versionCodes: [integer], userFraction: double }
*/
export async function updateTrack(edits: pub3.Resource$Edits, packageName: string, track: string, versionCode: string | string[], userFraction: number, updatePriority: number, releaseNotes?: pub3.Schema$LocalizedText[]): Promise<pub3.Schema$Track> {
export async function updateTrack(edits: pub3.Resource$Edits, packageName: string, track: string, versionCode: string | string[], userFraction: number, updatePriority: number, releaseNotes?: pub3.Schema$LocalizedText[], releaseName?: string): Promise<pub3.Schema$Track> {
tl.debug('Updating track');
const release: pub3.Schema$TrackRelease = {
versionCodes: (Array.isArray(versionCode) ? versionCode : [versionCode]),
inAppUpdatePriority: updatePriority
};

if (releaseName && releaseName.length > 0) {
tl.debug('Add release name: ' + releaseName);
release.name = releaseName;
}

if (releaseNotes && releaseNotes.length > 0) {
tl.debug('Attaching release notes to the update');
release.releaseNotes = releaseNotes;
Expand Down
10 changes: 9 additions & 1 deletion Tasks/GooglePlayReleaseBundle/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"version": {
"Major": "3",
"Minor": "189",
"Minor": "191",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down Expand Up @@ -185,6 +185,14 @@
"helpMarkDown": "The path to the proguard mapping.txt file to upload.",
"visibleRule": "shouldUploadMappingFile = true"
},
{
"name": "releaseName",
"type": "string",
"label": "Release name",
"defaultValue": "",
"required": false,
"helpMarkDown": "The release name is only for use in Play Console and won't be visible to users. To make your release easier to identify, add a release name that's meaningful to you."
},
{
"name": "versionCodeFilterType",
"type": "pickList",
Expand Down
10 changes: 9 additions & 1 deletion Tasks/GooglePlayReleaseBundle/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"version": {
"Major": "3",
"Minor": "189",
"Minor": "191",
"Patch": "0"
},
"minimumAgentVersion": "2.182.1",
Expand Down Expand Up @@ -185,6 +185,14 @@
"helpMarkDown": "ms-resource:loc.input.help.mappingFilePath",
"visibleRule": "shouldUploadMappingFile = true"
},
{
"name": "releaseName",
"type": "string",
"label": "ms-resource:loc.input.label.releaseName",
"defaultValue": "",
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.releaseName"
},
{
"name": "versionCodeFilterType",
"type": "pickList",
Expand Down

0 comments on commit 27b2dc5

Please sign in to comment.