-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.yml
146 lines (125 loc) · 4.1 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
trigger: none
pr: none
pool:
vmImage: 'windows-latest'
variables:
- group: CodeSigning
- name: solution
value: '**/*.sln'
- name: buildPlatform
value: 'x86'
- name: buildConfiguration
value: 'Release'
- name: isMain
value: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
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: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: '18.x'
- task: NuGetCommand@2
displayName: NuGet Restore
inputs:
command: restore
restoreSolution: '**/*.sln'
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
projects: '**/*.csproj'
feedsToUse: 'select'
includeNuGetOrg: true
- 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)'
testAssemblyVer2: |
**/MarkMpn.*.Tests.dll
!**\obj\**
- task: NuGetToolInstaller@1
inputs:
versionSpec: '*'
checkLatest: true
- 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'
- script: |
call npm --no-git-tag-version version $(GitVersion.SemVer)
call npm i -g vsce
call yarn install
call gulp build
call gulp package:offline
displayName: Build ADS extension
workingDirectory: '$(Build.SourcesDirectory)\AzureDataStudioExtension'
- task: PublishPipelineArtifact@1
displayName: Publish ADS Extension installer to pipeline
inputs:
targetPath: 'AzureDataStudioExtension\azuredatastudio-sql4cds-$(GitVersion.SemVer).vsix'
artifact: 'ADSInstaller'
publishLocation: 'pipeline'
- task: GitTag@5
displayName: Label Source
condition: and(succeeded(), eq(variables.isMain, 'true'))
inputs:
workingdir: '$(Build.SourcesDirectory)'
tag: 'v$(GitVersion.NuGetVersion)'
env:
SYSTEM_ACCESSTOKEN: '$(System.AccessToken)'