-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.yml
106 lines (90 loc) · 3.05 KB
/
build.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
100
101
102
103
104
105
106
trigger: none
pr: none
pool:
vmImage: 'windows-latest'
variables:
- group: CodeSigning
- name: solution
value: '**/*.sln'
- name: buildPlatform
value: 'x86'
- name: buildConfiguration
value: 'Release'
steps:
- checkout: self
persistCredentials: true
- task: NuGetCommand@2
displayName: Install GitVersion
inputs:
command: custom
arguments: install GitVersion.CommandLine -Version 4.0.0 -OutputDirectory $(Build.BinariesDirectory)/tools -ExcludeVersion
- script: $(Build.BinariesDirectory)/tools/GitVersion.CommandLine/tools/GitVersion.exe /output buildserver /nofetch /updateassemblyinfo
displayName: Determine Version
- task: PowerShell@2
displayName: Update version in the vsix manifest
inputs:
filePath: 'MarkMpn.Sql4Cds.SSMS\update-version.ps1'
arguments: '$(GitVersion.AssemblySemVer)'
pwsh: true
- task: NuGetCommand@2
displayName: NuGet Restore
inputs:
command: restore
restoreSolution: '**/*.sln'
- task: VSBuild@1
displayName: Build
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/p:DeployExtension=false /p:Version=$(GitVersion.NuGetVersion)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: NuGetCommand@2
displayName: Pack
inputs:
command: pack
packagesToPack: '**/*.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)'
versioningScheme: byEnvVar
versionEnvVar: GITVERSION_NUGETVERSION
- task: PublishPipelineArtifact@1
displayName: Publish NuGet packages to pipeline
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'NuGetPackages'
publishLocation: 'pipeline'
- task: DownloadSecureFile@1
name: CodeSigningCert
displayName: Download code signing certificate
inputs:
secureFile: 'Code Signing.pfx'
- task: PowerShell@2
displayName: Sign MSI
inputs:
targetType: inline
script: |
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import("$(CodeSigningCert.secureFilePath)", "$(CodeSigningCertPassword)", [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::DefaultKeySet)
Set-AuthenticodeSignature -Certificate $cert -FilePath "MarkMpn.Sql4Cds.SSMS.Setup\bin\$(buildConfiguration)\MarkMpn.Sql4Cds.SSMS.Setup.msi" -TimestampServer "http:https://timestamp.digicert.com"
- task: PublishPipelineArtifact@1
displayName: Publish SSMS installer to pipeline
inputs:
targetPath: 'MarkMpn.Sql4Cds.SSMS.Setup\bin\$(buildConfiguration)\MarkMpn.Sql4Cds.SSMS.Setup.msi'
artifact: 'SSMSInstaller'
publishLocation: 'pipeline'
- task: PublishPipelineArtifact@1
displayName: Publish version file to pipeline
inputs:
targetPath: 'MarkMpn.Sql4Cds.SSMS\sql4cds-version.txt'
artifact: 'SSMSVersion'
publishLocation: 'pipeline'
- task: GitTag@5
displayName: Label Source
inputs:
workingdir: '$(Build.SourcesDirectory)'
tag: 'v$(GitVersion.NuGetVersion)'
env:
SYSTEM_ACCESSTOKEN: '$(System.AccessToken)'