added setupoptions for github
This commit is contained in:
@@ -8,7 +8,7 @@ import * as toolCache from "@actions/tool-cache";
|
||||
|
||||
import { injectable } from "inversify";
|
||||
|
||||
import { IBuildAgent, IExecResult } from "../interfaces";
|
||||
import { IBuildAgent, IExecResult } from "../interface";
|
||||
|
||||
@injectable()
|
||||
class BuildAgent implements IBuildAgent {
|
||||
@@ -61,6 +61,10 @@ class BuildAgent implements IBuildAgent {
|
||||
core.exportVariable(name, val);
|
||||
}
|
||||
|
||||
public getVariable(name: string): string {
|
||||
return process.env[name];
|
||||
}
|
||||
|
||||
public addPath(inputPath: string): void {
|
||||
core.addPath(inputPath);
|
||||
}
|
||||
@@ -94,6 +98,15 @@ class BuildAgent implements IBuildAgent {
|
||||
stdout,
|
||||
};
|
||||
}
|
||||
|
||||
public getInput(input: string, required?: boolean): string {
|
||||
return core.getInput(input, { required } as core.InputOptions);
|
||||
}
|
||||
|
||||
public getBooleanInput(input: string, required?: boolean): boolean {
|
||||
const inputValue = this.getInput(input, required);
|
||||
return (inputValue || "false").toLowerCase() === "true";
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "reflect-metadata";
|
||||
|
||||
import { IBuildAgent, IGitVersionTool } from "../interfaces";
|
||||
import { IBuildAgent, IGitVersionTool } from "../interface";
|
||||
import { TYPES } from "../types";
|
||||
import { ioc } from "./ioc";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Container } from "inversify";
|
||||
|
||||
import { DotnetTool, GitVersionTool, VersionManager } from "../common";
|
||||
import { IBuildAgent, IDotnetTool, IGitVersionTool, IVersionManager } from "../interfaces";
|
||||
import { IBuildAgent, IDotnetTool, IGitVersionTool, IVersionManager } from "../interface";
|
||||
import { TYPES } from "../types";
|
||||
import { BuildAgent } from "./build-agent";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "reflect-metadata";
|
||||
|
||||
import { IBuildAgent, IGitVersionTool } from "../interfaces";
|
||||
import { TYPES } from "../types";
|
||||
import { IBuildAgent, IGitVersionTool } from "../interface";
|
||||
import { SetupOptions, TYPES } from "../types";
|
||||
import { ioc } from "./ioc";
|
||||
|
||||
const gitVersionTool = ioc.get<IGitVersionTool>(TYPES.IGitVersionTool);
|
||||
@@ -10,11 +10,12 @@ 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 versionSpec = this.buildAgent.getInput(SetupOptions.versionSpec);
|
||||
const includePrerelease = this.buildAgent.getBooleanInput(SetupOptions.includePrerelease);
|
||||
|
||||
await gitVersionTool.install(versionSpec, includePrerelease);
|
||||
|
||||
buildAgent.setSucceeded("GitVersion installed successfully", true);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user