-
Notifications
You must be signed in to change notification settings - Fork 228
/
azure-pipelines.yml
99 lines (88 loc) · 2.9 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
pool:
vmImage: 'windows-latest'
variables:
Version.MajorMinor: '3.3'
Version.Semantic: $[format('{0}.{1}', variables['Version.MajorMinor'],
counter(variables['Version.MajorMinor'], 0))]
Version.Assembly: '$(Version.Semantic).0'
Year: $[format('{0:yyyy}', Pipeline.StartTime)]
jobs:
- job: Build
steps:
- task: Assembly-Info-NetFramework@2
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: 'src/HidLibrary/Properties/AssemblyInfo.cs'
InsertAttributes: false
FileEncoding: 'auto'
WriteBOM: false
Title: 'Hid Library'
Product: 'Hid Library'
Description: 'Hid Device Communication Library'
Company: 'Ultraviolet Catastrophe'
Copyright: 'Copyright © $(Year) Ultraviolet Catastrophe'
Trademark: 'Hid Library'
VersionNumber: '$(Version.Assembly)'
FileVersionNumber: '$(Version.Assembly)'
InformationalVersion: '$(Version.Assembly)'
LogLevel: 'verbose'
FailOnWarning: false
Configuration: 'Release'
- task: NuGetCommand@2
inputs:
command: 'restore'
feedsToUse: 'select'
restoreSolution: 'src/HidLibrary.sln'
- task: MSBuild@1
inputs:
solution: 'src/HidLibrary.sln'
configuration: 'Release'
clean: true
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
src/Tests/bin/Release/Tests.dll
searchFolder: '$(System.DefaultWorkingDirectory)'
- task: NuGetCommand@2
inputs:
command: 'pack'
packagesToPack: 'HidLibrary.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)/packages'
buildProperties: 'version=$(Version.Semantic)'
basePath: src/HidLibrary/bin/Release
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/packages'
artifactName: packages
- job: Deploy
dependsOn: Build
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
steps:
- checkout: self
persistCredentials: true
clean: true
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'packages'
downloadPath: '$(System.ArtifactsDirectory)'
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(System.ArtifactsDirectory)/packages/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'Nuget.org'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
git tag $(Version.Semantic)
Write-Host "Successfully created tag $(Version.Semantic)"
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
git push --tags
Write-Host "Successfully pushed tag $(Version.Semantic) to origin"