diff --git a/Tasks/GooglePlayPromote/Strings/resources.resjson/en-US/resources.resjson b/Tasks/GooglePlayPromote/Strings/resources.resjson/en-US/resources.resjson index 30ba014..848c3a9 100644 --- a/Tasks/GooglePlayPromote/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/GooglePlayPromote/Strings/resources.resjson/en-US/resources.resjson @@ -27,6 +27,7 @@ "loc.messages.EndpointNotFound": "The service connection could not be found.", "loc.messages.Authenticating": "Authenticating with Google Play", "loc.messages.GetTrackInfo": "Getting information for track %s", + "loc.messages.InvalidVersionCode": "Version code should be a positive integer", "loc.messages.PromoteTrack": "Promoting to track %s", "loc.messages.CleanTrack": "Cleaning up track %s", "loc.messages.PromoteSucceed": "APK successfully promoted!", diff --git a/Tasks/GooglePlayPromote/google-play-promote.ts b/Tasks/GooglePlayPromote/google-play-promote.ts index 563fba4..83b5b9d 100644 --- a/Tasks/GooglePlayPromote/google-play-promote.ts +++ b/Tasks/GooglePlayPromote/google-play-promote.ts @@ -58,7 +58,13 @@ async function run() { let releaseNotes = track.releases[0].releaseNotes; if (versionCode !== undefined) { - versionNumber = [Number(versionCode)]; + const versionCodeNumber = Number(versionCode); + + if (!Number.isInteger(versionCodeNumber) || versionCodeNumber <= 0) { + throw new Error(tl.loc('InvalidVersionCode')); + } + + versionNumber = [versionCodeNumber]; // don't override the release notes with latest release notes, potentially dangerous releaseNotes = undefined; } diff --git a/Tasks/GooglePlayPromote/task.json b/Tasks/GooglePlayPromote/task.json index dbd7798..58f6e9d 100644 --- a/Tasks/GooglePlayPromote/task.json +++ b/Tasks/GooglePlayPromote/task.json @@ -15,7 +15,7 @@ "version": { "Major": "3", "Minor": "186", - "Patch": "1" + "Patch": "2" }, "minimumAgentVersion": "2.182.1", "instanceNameFormat": "Promote $(packageName) from $(sourceTrack) to $(destinationTrack)", @@ -145,6 +145,7 @@ "EndpointNotFound": "The service connection could not be found.", "Authenticating": "Authenticating with Google Play", "GetTrackInfo": "Getting information for track %s", + "InvalidVersionCode": "Version code should be a positive integer", "PromoteTrack": "Promoting to track %s", "CleanTrack": "Cleaning up track %s", "PromoteSucceed": "APK successfully promoted!", diff --git a/Tasks/GooglePlayPromote/task.loc.json b/Tasks/GooglePlayPromote/task.loc.json index 71a9dc9..6abf368 100644 --- a/Tasks/GooglePlayPromote/task.loc.json +++ b/Tasks/GooglePlayPromote/task.loc.json @@ -15,7 +15,7 @@ "version": { "Major": "3", "Minor": "186", - "Patch": "1" + "Patch": "2" }, "minimumAgentVersion": "2.182.1", "instanceNameFormat": "ms-resource:loc.instanceNameFormat", @@ -145,6 +145,7 @@ "EndpointNotFound": "ms-resource:loc.messages.EndpointNotFound", "Authenticating": "ms-resource:loc.messages.Authenticating", "GetTrackInfo": "ms-resource:loc.messages.GetTrackInfo", + "InvalidVersionCode": "ms-resource:loc.messages.InvalidVersionCode", "PromoteTrack": "ms-resource:loc.messages.PromoteTrack", "CleanTrack": "ms-resource:loc.messages.CleanTrack", "PromoteSucceed": "ms-resource:loc.messages.PromoteSucceed",