This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
53 lines (43 loc) · 1.8 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
name: $(Year:yyyy).$(Month).$(DayOfMonth).$(Rev:r)
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
trigger:
branches:
include:
- master
- refs/tags/*
pr:
autoCancel: false
steps:
- powershell: |
$buildVersion = $env:BUILD_BUILDNUMBER
Write-Host "##vso[task.setvariable variable=assemblyVersion]$buildVersion"
Write-Host "Assembly version is" $buildVersion
displayName: 'Set the assembly version number.'
- powershell: |
$tagVersion = $env:BUILD_SOURCEBRANCH.remove(0, 10)
Write-Host "##vso[task.setvariable variable=assemblyVersion]$tagVersion"
Write-Host "*** TAG OVERWRITE :: Assembly version is" $tagVersion
displayName: 'Update assembly version to be the Tag value.'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
# Remove this task once .NET Core 2.2 is added to hosted agent.
- task: DotNetCoreInstaller@2
inputs:
packageType: 'sdk'
version: '3.1.407'
- script: dotnet build --configuration $(buildConfiguration) -p:Version=$(assemblyVersion)
displayName: 'dotnet build'
- task: DotNetCoreCLI@2
inputs:
command: test
projects: '**/tests/*/*.csproj'
arguments: '--configuration $(buildConfiguration) -p:Version=$(assemblyVersion) --no-build'
displayName: 'dotnet test'
- script: dotnet pack --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory) -p:Version=$(assemblyVersion) -v normal --no-build
displayName: 'dotnet pack [i.e. create nuget package]'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))