-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-csharp.yml
90 lines (78 loc) · 2.82 KB
/
azure-pipelines-csharp.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
83
84
85
86
87
88
89
90
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
name: Gravity.Abstraction.Logging.$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
pool:
name: Default
variables:
- group: browserstack.com
- name: 'buildConfiguration'
value: 'Release'
steps:
- task: DotNetCoreCLI@2
displayName: restore dependencies
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
vstsFeed: '6ed1caf9-de4f-48e8-8276-201533d86a19'
verbosityRestore: 'Diagnostic'
- task: DotNetCoreCLI@2
displayName: build projects
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- powershell: |
[xml]$doc = Get-Content azure-settings.runsettings
$doc.RunSettings.TestRunParameters.ChildNodes.Item(0).value = '$(Grid.Endpoint)'
$doc.RunSettings.TestRunParameters.ChildNodes.Item(1).value = '$(Grid.BasicAuthorization)'
$doc.RunSettings.TestRunParameters.ChildNodes.Item(2).value = '$(Build.BuildNumber)'
$doc.Save("azure-settings-prod.runsettings")
displayName: create test settings > override with production parameters
- task: DotNetCoreCLI@2
displayName: execute automated testing
inputs:
command: 'test'
projects: '**/*[Tt]ests/*.csproj'
arguments: '--configuration $(buildConfiguration) -s azure-settings-prod.runsettings'
testRunTitle: 'Automation Testing --- $(Build.BuildNumber)'
- powershell: |
Remove-Item azure-settings-prod.runsettings
displayName: cleanup
- task: DotNetCoreCLI@2
displayName: create package
inputs:
command: 'pack'
packagesToPack: '**/!(*[Tt]ests)/*.csproj'
versioningScheme: 'byBuildNumber'
verbosityPack: 'Diagnostic'
packDirectory: $(Build.ArtifactStagingDirectory)
- task: NuGetCommand@2
displayName: push package
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'nuget.org'
- task: PowerShell@2
displayName: 'parse build version for GitHub tag'
inputs:
targetType: 'inline'
script: |
# setup
[regex]$pattern = '(\d+.?)+'
$version = $pattern.Matches('$(Build.BuildNumber)') | foreach-object {$_.Value}
# set value
Write-Host "##vso[task.setvariable variable=buildVersion]$version"
- task: GitHubRelease@1
displayName: 'create GitHub tag'
inputs:
gitHubConnection: 'GitHub connection - Gravity API'
repositoryName: 'gravity-api/gravity-abstraction-logging'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: 'v$(buildVersion)'
title: 'Production v$(buildVersion)'
releaseNotesSource: 'inline'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'