Skip to content

Commit d8fcb3d

Browse files
keerthanakumarBryan Smith
authored andcommitted
Add mandatory flag
1 parent 74f4413 commit d8fcb3d

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Tasks/AppCenterDistributeV1/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"loc.input.help.releaseNotesInput": "Release notes for this version.",
2828
"loc.input.label.releaseNotesFile": "Release notes file",
2929
"loc.input.help.releaseNotesFile": "Select a UTF-8 encoded text file which contains the Release Notes for this version.",
30+
"loc.input.label.isMandatory": "Require users to update to this release",
3031
"loc.input.label.destinationId": "Destination ID",
3132
"loc.input.help.destinationId": "ID of the distribution group or store the app will deploy to. Leave it empty to use the default group.",
3233
"loc.messages.CannotDecodeEndpoint": "Could not decode the endpoint.",

Tasks/AppCenterDistributeV1/appcenterdistribute.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function commitRelease(apiServer: string, apiVersion: string, appSlug: string, u
145145
return defer.promise;
146146
}
147147

148-
function publishRelease(apiServer: string, releaseUrl: string, releaseNotes: string, destinationId: string, token: string, userAgent: string) {
148+
function publishRelease(apiServer: string, releaseUrl: string, isMandatory: boolean, releaseNotes: string, destinationId: string, token: string, userAgent: string) {
149149
tl.debug("-- Mark package available.");
150150
let defer = Q.defer<void>();
151151
let publishReleaseUrl: string = `${apiServer}/${releaseUrl}`;
@@ -160,6 +160,7 @@ function publishRelease(apiServer: string, releaseUrl: string, releaseNotes: str
160160
let publishBody = {
161161
"status": "available",
162162
"release_notes": releaseNotes,
163+
"mandatory_update": isMandatory,
163164
"destinations": [
164165
{
165166
"id": destinationId
@@ -426,6 +427,8 @@ async function run() {
426427
releaseNotes = tl.getInput('releaseNotesInput', true);
427428
}
428429

430+
let isMandatory: boolean = tl.getBoolInput('isMandatory', false);
431+
429432
let destinationId = tl.getInput('destinationId', false) || '00000000-0000-0000-0000-000000000000';
430433
tl.debug(`Effective destinationId: ${destinationId}`);
431434

@@ -459,7 +462,7 @@ async function run() {
459462
let packageUrl = await commitRelease(effectiveApiServer, effectiveApiVersion, appSlug, uploadInfo.upload_id, apiToken, userAgent);
460463

461464
// Publish
462-
await publishRelease(effectiveApiServer, packageUrl, releaseNotes, destinationId, apiToken, userAgent);
465+
await publishRelease(effectiveApiServer, packageUrl, isMandatory, releaseNotes, destinationId, apiToken, userAgent);
463466

464467
if (symbolsFile) {
465468
// Begin preparing upload symbols

Tasks/AppCenterDistributeV1/task.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@
157157
"helpMarkDown": "Select a UTF-8 encoded text file which contains the Release Notes for this version.",
158158
"visibleRule": "releaseNotesSelection = file"
159159
},
160+
{
161+
"name": "isMandatory",
162+
"type": "boolean",
163+
"label": "Require users to update to this release",
164+
"defaultValue": "false",
165+
"required": false
166+
},
160167
{
161168
"name": "destinationId",
162169
"aliases": [

0 commit comments

Comments
 (0)