-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
82 lines (67 loc) · 2.05 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
pool:
vmImage: 'ubuntu-latest'
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- checkout: self
persistCredentials: true
- task: GitVersion@5
displayName: Use git version
inputs:
versionSpec: '5.*'
updateAssemblyInfo: false
- pwsh: |
$version = "$(Build.BuildNumber)" -replace "\+", "."
Write-Host "##vso[build.updatebuildnumber]$version"
displayName: Clean Build Number
- task: NuGetToolInstaller@1
displayName: Install nuget tool
- task: UseDotNet@2
displayName: Use dotnet sdk 6.x
inputs:
packageType: 'sdk'
version: '6.x'
- task: NuGetCommand@2
displayName: Restore nuget packages
inputs:
restoreSolution: '$(solution)'
- task: DotNetCoreCLI@2
displayName: Build solution
inputs:
command: build
configuration: Release
buildProperties: Version=$(Build.BuildNumber)
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: Run Tests
inputs:
command: test
arguments: --no-build -f net6.0
configuration: Release
projects: '**/*Tests.csproj'
- task: DotNetCoreCLI@2
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
versioningScheme: 'byBuildNumber'
- ${{if eq(variables['Build.SourceBranchName'], 'main')}}:
- task: NuGetCommand@2
displayName: Push nuget package to Nuget.Org
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'Nuget Org'
- pwsh: |
$userEmail="$(Build.RequestedForEmail)"
$userName="$(Build.RequestedFor)"
$tag="$(Build.BuildNumber)"
git config --global user.email "$userEmail"
git config --global user.name "$userName"
$timeStamp = Get-Date -Format "dd MMM yyyy HH:mm"
$tagMessage = "Released: $timeStamp"
git tag -a $tag -m $tagMessage
git push origin $tag --force
Write-Host "Annotated tag '$tag [$tagMessage]' pushed to remote/origin"
displayName: GIT Tag Release