prepare the execute part
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import "reflect-metadata";
|
||||
|
||||
import { IBuildAgent, IGitVersionTool } from "../interfaces";
|
||||
import { TYPES } from "../types";
|
||||
import { IBuildAgent, IGitVersionOptions, IGitVersionTool } from "../interfaces";
|
||||
import { RunOptions, TYPES } from "../types";
|
||||
import { ioc } from "./ioc";
|
||||
|
||||
const gitVersionTool = ioc.get<IGitVersionTool>(TYPES.IGitVersionTool);
|
||||
@@ -10,11 +10,11 @@ const buildAgent = ioc.get<IBuildAgent>(TYPES.IBuildAgent);
|
||||
export async function run() {
|
||||
try {
|
||||
|
||||
const version = "5.1.2";
|
||||
const includePrerelease = false;
|
||||
|
||||
buildAgent.exportVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
|
||||
await gitVersionTool.install(version, includePrerelease);
|
||||
|
||||
const inputOptions: IGitVersionOptions = getGitVersionOptions();
|
||||
|
||||
await gitVersionTool.run(inputOptions);
|
||||
|
||||
buildAgent.setSucceeded("GitVersion installed successfully", true);
|
||||
} catch (error) {
|
||||
@@ -22,4 +22,26 @@ export async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
function getGitVersionOptions(): IGitVersionOptions {
|
||||
|
||||
const targetPath = buildAgent.getInput(RunOptions.targetPath);
|
||||
|
||||
const useConfigFile = buildAgent.getBooleanInput(RunOptions.useConfigFile);
|
||||
const configFilePath = buildAgent.getInput(RunOptions.configFilePath);
|
||||
|
||||
const updateAssemblyInfo = buildAgent.getBooleanInput(RunOptions.updateAssemblyInfo);
|
||||
const updateAssemblyInfoFilename = buildAgent.getInput(RunOptions.updateAssemblyInfoFilename);
|
||||
|
||||
const additionalArguments = buildAgent.getInput(RunOptions.additionalArguments);
|
||||
|
||||
return {
|
||||
targetPath,
|
||||
useConfigFile,
|
||||
configFilePath,
|
||||
updateAssemblyInfo,
|
||||
updateAssemblyInfoFilename,
|
||||
additionalArguments,
|
||||
};
|
||||
}
|
||||
|
||||
run();
|
||||
|
||||
Reference in New Issue
Block a user