forked from secana/PeNet-Analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
58 lines (48 loc) · 1.63 KB
/
azure-pipelines.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
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
pool:
vmImage: 'windows-2022'
variables:
buildConfiguration: 'Release'
steps:
- powershell: $version = ($env:Build_SourceBranch -replace 'refs/tags/v',''); echo $version; echo "##vso[task.setvariable variable=version]$version"
displayName: Get version from tag
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- powershell: ((Get-Content -path .\src\PeNet.Analyzer\PeNet.Analyzer.csproj -Raw) -replace '0.0.0',$env:version) | Set-Content -Path .\src\PeNet.Analyzer\PeNet.Analyzer.csproj
displayName: Replace version with git tag
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- task: UseDotNet@2
displayName: "Use .NET Core 7.x"
inputs:
version: '7.x'
packageType: sdk
- task: DotNetCoreCLI@2
displayName: 'Run Unit-Tests'
inputs:
command: test
projects: '**/*test/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
- task: NuGetToolInstaller@0
displayName: Install NuGet
inputs:
versionSpec: '5.4.0'
- task: DotNetCoreCLI@2
displayName: 'Pack Nuget Package'
inputs:
command: 'pack'
packagesToPack: '**\src\**\*.csproj'
configuration: $(buildConfiguration)
- task: NuGetCommand@2
displayName: 'Publish NuGet Packages'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
command: push
nuGetFeedType: external
allowPackageConflicts: true
publishFeedCredentials: 'Nuget.org'
packagesToPush: '$(build.artifactStagingDirectory)/*.nupkg'