forked from fiskaltrust/middleware-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vsts-ci.yml
58 lines (52 loc) · 2.3 KB
/
.vsts-ci.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
56
57
58
resources:
- repo: self
queue:
name: ft-a240-sandbox
demands:
- msbuild
- visualstudio
steps:
- powershell: |
$versionFromFile = Get-Content "version.txt"
$majorMinor = $versionFromFile.Split("-")[0]
$prerelease = $versionFromFile.Substring($majorMinor.Length, $versionFromFile.Length - $majorMinor.Length)
$version = "$majorMinor.$(Get-Date -UFormat "%y")$("{0:D3}" -f (Get-Date).DayofYear).$env:BUILD_BUILDID"
$gitHash = "+" + (git rev-parse HEAD).SubString(0, 10)
Write-Host "Version: $version"
Write-Host "Inform Version: $version$prerelease$gitHash"
Get-ChildItem -Recurse -Include "AssemblyInfo.cs" | ForEach-Object {
$fileName = $_.FullName;
(Get-Content $fileName) -replace "AssemblyVersion\s*\(.*\)", "AssemblyVersion(`"$version`")" | Out-File $fileName
(Get-Content $fileName) -replace "AssemblyFileVersion\s*\(.*\)", "AssemblyFileVersion(`"$version`")" | Out-File $fileName
(Get-Content $fileName) -replace "AssemblyInformationalVersion\s*\(.*\)", "AssemblyInformationalVersion(`"$version$prerelease$gitHash`")" | Out-File $fileName
}
Write-Output ("##vso[build.updatebuildnumber]$version$prerelease")
displayName: Set Versions
- task: NuGetToolInstaller@0
displayName: Use NuGet 4.4.1
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: NuGet restore
inputs:
restoreSolution: 'c-sharp\**\*.sln'
- task: VSBuild@1
displayName: Build solution c-sharp\*.sln
inputs:
solution: 'c-sharp\*.sln'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- powershell: |
Get-ChildItem "c-sharp/src/**/**" -Directory | ForEach-Object {
$destinationDirectory = New-Item -ItemType directory -Path "$($env:BUILD_ARTIFACTSTAGINGDIRECTORY)\$($_.Name)" -Force
if(Test-Path "$($_.FullName)/bin/Release"){
Compress-Archive -Path "$($_.FullName)/bin/Release/**" -DestinationPath "$($env:BUILD_ARTIFACTSTAGINGDIRECTORY)\$($_.Name)-$(build.BuildNumber).zip"
}
}
displayName: Copy Project Buildartifacts to $(build.artifactstagingdirectory)
- task: PublishBuildArtifacts@1
displayName: Publish Artifact - github-utilities__$(build.BuildNumber)
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: github-demo__$(build.BuildNumber)
publishLocation: Container