added GRM create assets

This commit is contained in:
Artur Stolear
2020-02-08 20:32:41 +02:00
parent 274c9b2e99
commit 0e2e93e6aa
19 changed files with 147 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@@ -84,5 +84,12 @@
"defaultValue": "",
"required": false,
"helpMarkDown": "The directory on which GitReleaseManager should be executed. Defaults to current directory"
}, {
"name": "assets",
"type": "multiLine",
"label": "Path(s) to the file(s) to include in the release",
"defaultValue": "",
"required": false,
"helpMarkDown": "Path(s) to the file(s) to include in the release. Separated by newline"
}]
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -77,6 +77,13 @@ class BuildAgent implements IBuildAgent {
return taskLib.getInput(input, required);
}
public getListInput(input: string, required?: boolean): string[] {
return taskLib
.getInput(input, required)
.split("\n")
.filter(x => x !== "");
}
public getBooleanInput(input: string, required?: boolean): boolean {
return taskLib.getBoolInput(input, required);
}

View File

@@ -117,6 +117,13 @@ class BuildAgent implements IBuildAgent {
return core.getInput(input, { required } as core.InputOptions);
}
public getListInput(input: string, required?: boolean): string[] {
return core
.getInput(input, { required } as core.InputOptions)
.split("\n")
.filter(x => x !== "");
}
public getBooleanInput(input: string, required?: boolean): boolean {
const inputValue = this.getInput(input, required);
return (inputValue || "false").toLowerCase() === "true";

View File

@@ -78,6 +78,11 @@ class BuildAgent implements IBuildAgent {
return "getInput";
}
public getListInput(input: string, required?: boolean): string[] {
console.log("getListInput");
return ["getInput"];
}
public getBooleanInput(input: string, required?: boolean): boolean {
console.log("getBooleanInput");
return false;

View File

@@ -44,5 +44,6 @@ export interface IBuildAgent {
setOutput(name: string, value: string): void;
getInput(input: string, required?: boolean): string;
getListInput(input: string, required?: boolean): string[];
getBooleanInput(input: string, required?: boolean): boolean;
}

View File

@@ -66,6 +66,9 @@ export class GitReleaseManagerTool extends DotnetTool implements IGitReleaseMana
if (settings.isPreRelease) {
args.push("--pre");
}
if (settings.assets && settings.assets.length > 0) {
args.push("--assets", settings.assets.join(","));
}
return args;
}

View File

@@ -1,15 +1,16 @@
import { IBuildAgent } from "../../core/models";
import { GitReleaseManagerSettings, CommonFields, CreateFields } from "./models";
import { GitReleaseManagerSettings, CommonFields, CreateFields, GitReleaseManagerCreateSettings } from "./models";
export class Settings {
public static getCreateSettings(buildAgent: IBuildAgent) {
public static getCreateSettings(buildAgent: IBuildAgent) : GitReleaseManagerCreateSettings {
const milestone = buildAgent.getInput(CreateFields.milestone);
const releaseName = buildAgent.getInput(CreateFields.releaseName);
const inputFileName = buildAgent.getInput(CreateFields.inputFileName);
const isPreRelease = buildAgent.getBooleanInput(CreateFields.isPreRelease);
const commit = buildAgent.getInput(CreateFields.commit);
const targetDirectory = buildAgent.getInput(CreateFields.targetDirectory);
const assets = buildAgent.getListInput(CreateFields.assets);
const commonSettings = Settings.getCommonSettings(buildAgent);
return {
@@ -19,7 +20,8 @@ export class Settings {
inputFileName,
isPreRelease,
commit,
targetDirectory
targetDirectory,
assets
}
}