test the output and variables
This commit is contained in:
@@ -28,9 +28,16 @@ steps:
|
||||
npm run format-check
|
||||
npm run build:azure
|
||||
displayName: 'Build code'
|
||||
- bash: 'INPUT_VERSIONSPEC=$(INPUT_VERSIONSPEC) node ./gitversion/setup/bundle.js'
|
||||
- pwsh: $env:INPUT_VERSIONSPEC = "$(INPUT_VERSIONSPEC)"; node ./gitversion/setup/bundle.js
|
||||
displayName: gitversion/setup
|
||||
workingDirectory: dist/azure
|
||||
- bash: 'node ./gitversion/execute/bundle.js'
|
||||
- pwsh: node ./gitversion/execute/bundle.js
|
||||
name: version
|
||||
displayName: gitversion/execute
|
||||
workingDirectory: dist/azure
|
||||
- pwsh: |
|
||||
echo "FullSemVer (fullSemVer) : $(fullSemVer)"
|
||||
echo "FullSemVer (GitVersion_FullSemVer) : $(GitVersion_FullSemVer)"
|
||||
echo "FullSemVer (version.fullSemVer) : $(version.fullSemVer)"
|
||||
echo "FullSemVer (version.GitVersion_FullSemVer) : $(version.GitVersion_FullSemVer)"
|
||||
displayName: Use variables and output
|
||||
|
||||
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -34,4 +34,8 @@ jobs:
|
||||
id: gitversion # step id used as reference for output values
|
||||
uses: ./gitversion/execute
|
||||
- run: |
|
||||
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
|
||||
echo "FullSemVer (env.fullSemVer) : ${{ env.fullSemVer }}"
|
||||
echo "FullSemVer (env.GitVersion_FullSemVer) : ${{ env.GitVersion_FullSemVer }}"
|
||||
echo "FullSemVer (steps.gitversion.outputs.fullSemVer) : ${{ steps.gitversion.outputs.fullSemVer }}"
|
||||
echo "FullSemVer (steps.gitversion.outputs.GitVersion_FullSemVer) : ${{ steps.gitversion.outputs.GitVersion_FullSemVer }}"
|
||||
name: Use variables and output
|
||||
|
||||
@@ -44,8 +44,8 @@ class BuildAgent implements IBuildAgent {
|
||||
taskLib.setResult(taskLib.TaskResult.Succeeded, message, done)
|
||||
}
|
||||
|
||||
public exportVariable(name: string, val: string): void {
|
||||
taskLib.setVariable(name, val)
|
||||
public setVariable(name: string, value: string): void {
|
||||
taskLib.setVariable(name, value)
|
||||
}
|
||||
|
||||
public getVariable(name: string): string {
|
||||
@@ -78,7 +78,7 @@ class BuildAgent implements IBuildAgent {
|
||||
}
|
||||
|
||||
public setOutput(name: string, value: string): void {
|
||||
taskLib.setVariable(name, value)
|
||||
taskLib.setVariable(name, value, false, true)
|
||||
}
|
||||
|
||||
public getInput(input: string, required?: boolean): string {
|
||||
|
||||
@@ -110,7 +110,7 @@ class BuildAgent implements IBuildAgent {
|
||||
//
|
||||
}
|
||||
|
||||
public exportVariable(name: string, val: string): void {
|
||||
public setVariable(name: string, val: string): void {
|
||||
core.exportVariable(name, val)
|
||||
}
|
||||
|
||||
@@ -155,7 +155,6 @@ class BuildAgent implements IBuildAgent {
|
||||
|
||||
public setOutput(name: string, value: string): void {
|
||||
core.setOutput(name, value)
|
||||
core.exportVariable(`GITVERSION_${name.toUpperCase()}`, value)
|
||||
}
|
||||
|
||||
public getInput(input: string, required?: boolean): string {
|
||||
|
||||
@@ -41,8 +41,8 @@ class BuildAgent implements IBuildAgent {
|
||||
console.log('setSucceeded')
|
||||
}
|
||||
|
||||
public exportVariable(name: string, val: string): void {
|
||||
console.log('exportVariable')
|
||||
public setVariable(name: string, val: string): void {
|
||||
console.log('setVariable')
|
||||
}
|
||||
|
||||
public getVariable(name: string): string {
|
||||
|
||||
@@ -28,8 +28,8 @@ export class DotnetTool implements IDotnetTool {
|
||||
}
|
||||
|
||||
public disableTelemetry(): void {
|
||||
this.buildAgent.exportVariable('DOTNET_CLI_TELEMETRY_OPTOUT', 'true')
|
||||
this.buildAgent.exportVariable('DOTNET_NOLOGO', 'true')
|
||||
this.buildAgent.setVariable('DOTNET_CLI_TELEMETRY_OPTOUT', 'true')
|
||||
this.buildAgent.setVariable('DOTNET_NOLOGO', 'true')
|
||||
}
|
||||
|
||||
public execute(cmd: string, args: string[]): Promise<IExecResult> {
|
||||
@@ -102,7 +102,7 @@ export class DotnetTool implements IDotnetTool {
|
||||
let dotnetPath = await this.buildAgent.which('dotnet')
|
||||
dotnetPath = fs.readlinkSync(dotnetPath) || dotnetPath
|
||||
const dotnetRoot = path.dirname(dotnetPath)
|
||||
this.buildAgent.exportVariable('DOTNET_ROOT', dotnetRoot)
|
||||
this.buildAgent.setVariable('DOTNET_ROOT', dotnetRoot)
|
||||
}
|
||||
this.buildAgent.addPath(toolPath)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface IBuildAgent {
|
||||
debug(message: string): void
|
||||
setFailed(message: string, done?: boolean): void
|
||||
setSucceeded(message: string, done?: boolean): void
|
||||
exportVariable(name: string, val: string): void
|
||||
setVariable(name: string, val: string): void
|
||||
getVariable(name: string): string
|
||||
addPath(inputPath: string): void
|
||||
which(tool: string, check?: boolean): Promise<string>
|
||||
|
||||
@@ -83,6 +83,9 @@ export class GitVersionTool extends DotnetTool implements IGitVersionTool {
|
||||
const name = this.toCamelCase(property)
|
||||
const value = gitversionOutput[property]
|
||||
this.buildAgent.setOutput(name, value)
|
||||
this.buildAgent.setOutput(`GitVersion_${name}`, value)
|
||||
this.buildAgent.setVariable(name, value)
|
||||
this.buildAgent.setVariable(`GitVersion_${name}`, value)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user