-
Notifications
You must be signed in to change notification settings - Fork 5
/
GitVersion-job.yml
55 lines (46 loc) · 2.05 KB
/
GitVersion-job.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
parameters:
# It seems that currently, the gitversion task isn't working elsewhere
pool:
vmImage: 'windows-2019'
jobs:
- job: Initialize
pool: ${{ parameters.pool }}
steps:
- checkout: self
lfs: true
- template: GitVersion-step.yml
- powershell: |
@{
Counter = '$(GitVersion.MajorMinorPatch)'
SafeBranchName = '$(GitVersion.BranchName)' -replace '[\\/]','-'
SubModuleCount = @(git submodule foreach :).Count
HasSolutionFile = Test-Path *.sln
HasProjectFile = Test-Path *.*proj
HasDotNetProject = (Test-Path *.csproj, *.fsproj, *.sln) -contains $true
}.GetEnumerator().ForEach({
Write-Host ("EXPORT {0} = {1}`n##vso[task.setvariable variable={0};isOutput=true]{1}" -f $_.Key, $_.Value)
})
name: Output
displayName: Export Variables
- job: GitVersion
dependsOn: Initialize
pool: ${{ parameters.pool }}
variables:
BUILDCOUNT: $[counter(dependencies.Initialize.outputs['Output.Counter'], 0)]
SAFEBRANCHNAME: $[dependencies.Initialize.outputs['Output.SafeBranchName']]
steps:
- checkout: self
lfs: true
- template: GitVersion-step.yml
- powershell: |
foreach ($envar in Get-Item ENV:GITVERSION_*) {
Write-Host "INFO [task.setvariable variable=$(($envar.Name -split "_",2)[1]);isOutput=true]$($envar.Value)"
Write-Host "##vso[task.setvariable variable=$(($envar.Name -split "_",2)[1]);isOutput=true]$($envar.Value)"
}
# Also pass through the variables from initialize
Write-Host "INFO [task.setvariable variable=BUILDCOUNT;isOutput=true]$Env:BUILDCOUNT"
Write-Host "##vso[task.setvariable variable=BUILDCOUNT;isOutput=true]$Env:BUILDCOUNT"
Write-Host "INFO [task.setvariable variable=SAFEBRANCHNAME;isOutput=true]$Env:SAFEBRANCHNAME"
Write-Host "##vso[task.setvariable variable=SAFEBRANCHNAME;isOutput=true]$Env:SAFEBRANCHNAME"
name: GitVersion
displayName: Export GitVersion Variables