working on output
This commit is contained in:
23
dist/github/execute/index.js
vendored
23
dist/github/execute/index.js
vendored
File diff suppressed because one or more lines are too long
11
dist/github/setup/index.js
vendored
11
dist/github/setup/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -65,6 +65,10 @@ class BuildAgent implements IBuildAgent {
|
|||||||
return this.getVariable("Build.SourcesDirectory");
|
return this.getVariable("Build.SourcesDirectory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setOutput(name: string, value: string): void {
|
||||||
|
taskLib.setVariable(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
public getInput(input: string, required?: boolean): string {
|
public getInput(input: string, required?: boolean): string {
|
||||||
return taskLib.getInput(input, required);
|
return taskLib.getInput(input, required);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class GitVersionTool implements IGitVersionTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async install(versionSpec: string, includePrerelease: boolean): Promise<void> {
|
public async install(versionSpec: string, includePrerelease: boolean): Promise<void> {
|
||||||
const toolPath = await this.dotnetTool.toolInstall("GitVersion.Tool", versionSpec, false, includePrerelease);
|
await this.dotnetTool.toolInstall("GitVersion.Tool", versionSpec, false, includePrerelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(options: IGitVersionOptions): Promise<IExecResult> {
|
public run(options: IGitVersionOptions): Promise<IExecResult> {
|
||||||
@@ -188,7 +188,7 @@ class GitVersionTool implements IGitVersionTool {
|
|||||||
const args = [
|
const args = [
|
||||||
workDir,
|
workDir,
|
||||||
"/output",
|
"/output",
|
||||||
"buildserver",
|
"json",
|
||||||
];
|
];
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -105,6 +105,10 @@ public Stats;
|
|||||||
return this.getVariable("GITHUB_WORKSPACE");
|
return this.getVariable("GITHUB_WORKSPACE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setOutput(name: string, value: string): void {
|
||||||
|
core.setOutput(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
public getInput(input: string, required?: boolean): string {
|
public getInput(input: string, required?: boolean): string {
|
||||||
return core.getInput(input, { required } as core.InputOptions);
|
return core.getInput(input, { required } as core.InputOptions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,15 @@ export async function run() {
|
|||||||
try {
|
try {
|
||||||
const inputOptions: IGitVersionOptions = getGitVersionOptions();
|
const inputOptions: IGitVersionOptions = getGitVersionOptions();
|
||||||
|
|
||||||
await gitVersionTool.run(inputOptions);
|
const result = await gitVersionTool.run(inputOptions);
|
||||||
|
console.log(result.stdout);
|
||||||
|
|
||||||
|
if (result.code === 0) {
|
||||||
|
buildAgent.setSucceeded("GitVersion executed successfully", true);
|
||||||
|
} else {
|
||||||
|
buildAgent.setFailed(result.error.message, true);
|
||||||
|
}
|
||||||
|
|
||||||
buildAgent.setSucceeded("GitVersion installed successfully", true);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
buildAgent.setFailed(error, true);
|
buildAgent.setFailed(error, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,35 @@
|
|||||||
export interface IVersionManager {
|
export interface IVersionManager {
|
||||||
isExplicitVersion: (versionSpec: string) => boolean;
|
isExplicitVersion(versionSpec: string): boolean;
|
||||||
evaluateVersions: (versions: string[], versionSpec: string) => string;
|
evaluateVersions(versions: string[], versionSpec: string): string;
|
||||||
cleanVersion: (version: string) => string;
|
cleanVersion(version: string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBuildAgent {
|
export interface IBuildAgent {
|
||||||
find: (toolName: string, versionSpec: string, arch?: string) => string;
|
find(toolName: string, versionSpec: string, arch?: string): string;
|
||||||
cacheDir: (sourceDir: string, tool: string, version: string, arch?: string) => Promise<string>;
|
cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||||
createTempDir: () => Promise<string>;
|
createTempDir(): Promise<string>;
|
||||||
debug: (message: string) => void;
|
debug(message: string): void;
|
||||||
setFailed: (message: string, done?: boolean) => void;
|
setFailed(message: string, done?: boolean): void;
|
||||||
setSucceeded: (message: string, done?: boolean) => void;
|
setSucceeded(message: string, done?: boolean): void;
|
||||||
exportVariable: (name: string, val: string) => void;
|
exportVariable(name: string, val: string): void;
|
||||||
getVariable: (name: string) => string;
|
getVariable(name: string): string;
|
||||||
addPath: (inputPath: string) => void;
|
addPath(inputPath: string): void;
|
||||||
which: (tool: string, check?: boolean) => Promise<string>;
|
which(tool: string, check?: boolean): Promise<string>;
|
||||||
exec: (exec: string, args: string[]) => Promise<IExecResult>;
|
exec(exec: string, args: string[]): Promise<IExecResult>;
|
||||||
getSourceDir: () => string;
|
|
||||||
|
getSourceDir(): string;
|
||||||
isValidInputFile(input: string, file: string): boolean;
|
isValidInputFile(input: string, file: string): boolean;
|
||||||
fileExists(file: string): boolean;
|
fileExists(file: string): boolean;
|
||||||
directoryExists(file: string): boolean;
|
directoryExists(file: string): boolean;
|
||||||
|
|
||||||
|
setOutput(name: string, value: string): void;
|
||||||
getInput(input: string, required?: boolean): string;
|
getInput(input: string, required?: boolean): string;
|
||||||
getBooleanInput(input: string, required?: boolean): boolean;
|
getBooleanInput(input: string, required?: boolean): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDotnetTool {
|
export interface IDotnetTool {
|
||||||
run: (args: string[]) => Promise<IExecResult>;
|
run(args: string[]): Promise<IExecResult>;
|
||||||
toolInstall: (toolName: string, versionSpec: string, checkLatest: boolean, includePre: boolean) => Promise<string>;
|
toolInstall(toolName: string, versionSpec: string, checkLatest: boolean, includePre: boolean): Promise<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Argument {
|
export class Argument {
|
||||||
@@ -35,8 +37,8 @@ export class Argument {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface IGitVersionTool {
|
export interface IGitVersionTool {
|
||||||
install: (versionSpec: string, includePrerelease: boolean) => Promise<void>;
|
install(versionSpec: string, includePrerelease: boolean): Promise<void>;
|
||||||
run: (options: IGitVersionOptions) => Promise<IExecResult>;
|
run(options: IGitVersionOptions): Promise<IExecResult>;
|
||||||
}
|
}
|
||||||
export interface IExecResult {
|
export interface IExecResult {
|
||||||
stdout: string;
|
stdout: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user