diff --git a/task/precodesigning.ts b/task/precodesigning.ts index 7204675..ab4f1eb 100644 --- a/task/precodesigning.ts +++ b/task/precodesigning.ts @@ -7,9 +7,18 @@ async function run(): Promise { let secureFileHelper: sec.SecureFileDownloader = new sec.SecureFileDownloader(); try { tl.setResourcePath(path.join(__dirname, "task.json")); + + let secureFilePath: string; + let secureFileLocation: string = tl.getInput("secureFileLocation", true); + if (secureFileLocation == "azure") { + secureFileId = tl.getInput("secureFileId", true); + secureFilePath = await secureFileHelper.downloadSecureFile(secureFileId); + } + else if (secureFileLocation == "filepath") + secureFilePath = tl.getInput("secureFileLocalPath", true); + else + throw "The configured secure file location is invalid." - secureFileId = tl.getInput("secureFileId", true); - let secureFilePath: string = await secureFileHelper.downloadSecureFile(secureFileId); tl.setTaskVariable("SECURE_FILE_PATH", secureFilePath); } catch (err) { tl.setResult(tl.TaskResult.Failed, err); diff --git a/task/task.json b/task/task.json index 28e4cfe..895e30e 100644 --- a/task/task.json +++ b/task/task.json @@ -19,14 +19,36 @@ "minimumAgentVersion": "2.116.0", "instanceNameFormat": "Code Signing $(filePath)", "inputs": [ + { + "name": "secureFileLocation", + "type": "radio", + "label": "Secure File Location", + "helpMarkDown": "Indicates where the secure file is located. Certificate can either be retrieved from the project's secure files library or a specific filesystem path on the build machine.", + "required": true, + "defaultValue": "azure", + "options": { + "azure": "Azure secure files library", + "filepath": "Local filepath" + } + }, { "name": "secureFileId", "type": "secureFile", "label": "Secure File", "defaultValue": "", - "required": true, + "required": false, + "visibleRule": "secureFileLocation = azure", "helpMarkDown": "Select the certificate that was uploaded to `Secure Files` to be used to sign the given files." }, + { + "name": "secureFileLocalPath", + "type": "string", + "label": "Secure File Path", + "defaultValue": "", + "required": false, + "visibleRule": "secureFileLocation = filepath", + "helpMarkDown": "Enter the filepath of the certificate to be used to sign the given files." + }, { "name": "signCertPassword", "type": "string",