-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.yml
160 lines (137 loc) · 5.12 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
trigger: none
pr: none
pool:
vmImage: 'windows-latest'
variables:
- group: CodeSigning
- name: solution
value: '**/*.sln'
- name: buildPlatform
value: 'Any CPU'
- 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 5.12.0 -OutputDirectory $(Build.BinariesDirectory)/tools -ExcludeVersion
- script: $(Build.BinariesDirectory)/tools/GitVersion.CommandLine/tools/GitVersion.exe /output buildserver /nofetch /updateassemblyinfo
displayName: Determine Version (NetFX)
- script: $(Build.BinariesDirectory)/tools/GitVersion.CommandLine/tools/GitVersion.exe /output buildserver /nofetch /updateprojectfiles
displayName: Determine Version (NetCore)
- 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: '20.x'
- 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.20.Setup\bin\$(buildConfiguration)\MarkMpn.Sql4Cds.SSMS.20.Setup.msi" -TimestampServer "http://timestamp.digicert.com"
Set-AuthenticodeSignature -Certificate $cert -FilePath "MarkMpn.Sql4Cds.SSMS.21.Setup\bin\$(buildConfiguration)\MarkMpn.Sql4Cds.SSMS.21.Setup.msi" -TimestampServer "http://timestamp.digicert.com"
- task: PublishPipelineArtifact@1
displayName: Publish SSMS 20 installer to pipeline
inputs:
targetPath: 'MarkMpn.Sql4Cds.SSMS.20.Setup\bin\$(buildConfiguration)\MarkMpn.Sql4Cds.SSMS.20.Setup.msi'
artifact: 'SSMS20Installer'
publishLocation: 'pipeline'
- task: PublishPipelineArtifact@1
displayName: Publish SSMS 21 installer to pipeline
inputs:
targetPath: 'MarkMpn.Sql4Cds.SSMS.21.Setup\bin\$(buildConfiguration)\MarkMpn.Sql4Cds.SSMS.21.Setup.msi'
artifact: 'SSMS21Installer'
publishLocation: 'pipeline'
- task: PublishPipelineArtifact@1
displayName: Publish Debug Visualizer installer to pipeline
inputs:
targetPath: 'MarkMpn.Sql4Cds.DebugVisualizer.DebuggerSide\bin\$(buildConfiguration)\net472\MarkMpn.Sql4Cds.DebugVisualizer.DebuggerSide.vsix'
artifact: 'DebugVisualizer'
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 git config --global url."https://github".insteadOf ssh://git@github
call git config --global url."https://github.com/".insteadOf git@github.com:
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)'