3
3
4
4
name : $(Date:yyyyMMdd)$(Rev:.r).0-$(SourceBranchName)
5
5
6
+ parameters :
7
+ - name : SignTypeOverride
8
+ displayName : Signing type override
9
+ type : string
10
+ default : default
11
+ values :
12
+ - default
13
+ - test
14
+ - real
15
+
6
16
pr :
7
17
- master
8
18
- dev
@@ -19,7 +29,27 @@ trigger:
19
29
pool :
20
30
name : VSEngSS-MicroBuild2019-1ES
21
31
32
+ variables :
33
+ # MicroBuild requires TeamName to be set.
34
+ TeamName : C++ Cross Platform and Cloud
35
+ # If the user didn't override the signing type, then only real-sign on master
36
+ # or dev.
37
+ ${{ if ne(parameters.SignTypeOverride, 'default') }} :
38
+ SignType : ${{ parameters.SignTypeOverride }}
39
+ ${{ if and(eq(parameters.SignTypeOverride, 'default'), or(eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'dev'))) }} :
40
+ SignType : real
41
+ ${{ if and(eq(parameters.SignTypeOverride, 'default'), not(or(eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'dev')))) }} :
42
+ SignType : test
43
+
22
44
steps :
45
+ - task : MicroBuildSigningPlugin@3
46
+ displayName : Install MicroBuild Signing
47
+ inputs :
48
+ signType : $(SignType)
49
+ zipSources : false
50
+ # MicroBuild signing will always fail on public PRs.
51
+ condition : ne(variables['Build.Reason'], 'PullRequest')
52
+
23
53
# Run these scanners first so that they don't detect issues in dependencies.
24
54
# Failures won't break the build until "Check for compliance errors" step.
25
55
- task : CredScan@2
@@ -48,15 +78,56 @@ steps:
48
78
- script : gulp genAikey
49
79
displayName : Use production AI key
50
80
condition : and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
81
+ - script : gulp build --mode=production
82
+ displayName : Build extension
83
+ # Pack the extension now even though it's unsigned so that we ignore files
84
+ # from .vscodeignore. This will reduce load on the signing server later and
85
+ # ensure we only attempt to sign shipping files.
51
86
- script : vsce package --out vscode-arduino.vsix
52
- displayName : Build and pack extension
53
- - publish : vscode-arduino.vsix
54
- artifact : VS Code extension VSIX
55
- displayName : Publish extension VSIX as artifact
87
+ displayName : Pack extension
56
88
57
89
- task : ComponentGovernanceComponentDetection@0
58
90
displayName : Detect components
59
91
92
+ # Extract the VSIX, sign what we can, then pack it back up and publish it.
93
+ - task : ExtractFiles@1
94
+ displayName : Extract extension for signing
95
+ inputs :
96
+ archiveFilePatterns : vscode-arduino.vsix
97
+ destinationFolder : $(Build.StagingDirectory)\vscode-arduino
98
+ - task : NuGetToolInstaller@1
99
+ displayName : Install NuGet
100
+ - task : NuGetAuthenticate@0
101
+ displayName : Authenticate NuGet
102
+ - script : nuget restore .\build\SignFiles.proj -PackagesDirectory .\build\packages
103
+ displayName : Restore MicroBuild Core
104
+ # MicroBuild signing will always fail on public PRs.
105
+ condition : ne(variables['Build.Reason'], 'PullRequest')
106
+ - task : MSBuild@1
107
+ displayName : Sign files
108
+ inputs :
109
+ solution : .\build\SignFiles.proj
110
+ msbuildArguments : /p:SignType=$(SignType)
111
+ # MicroBuild signing will always fail on public PRs.
112
+ condition : ne(variables['Build.Reason'], 'PullRequest')
113
+ - task : ArchiveFiles@2
114
+ displayName : Pack signed files
115
+ inputs :
116
+ rootFolderOrFile : $(Build.StagingDirectory)\vscode-arduino
117
+ includeRootFolder : false
118
+ archiveType : zip
119
+ archiveFile : $(Build.StagingDirectory)\vscode-arduino.vsix
120
+ - task : MSBuild@1
121
+ displayName : Sign VSIX
122
+ inputs :
123
+ solution : .\build\SignVsix.proj
124
+ msbuildArguments : /p:SignType=$(SignType)
125
+ # MicroBuild signing will always fail on public PRs.
126
+ condition : ne(variables['Build.Reason'], 'PullRequest')
127
+ - publish : $(Build.StagingDirectory)\vscode-arduino.vsix
128
+ artifact : VS Code extension VSIX
129
+ displayName : Publish extension VSIX as artifact
130
+
60
131
# Install the Arduino IDE and run tests.
61
132
- script : curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip
62
133
displayName : Download Arduino IDE
@@ -114,6 +185,9 @@ steps:
114
185
action : create
115
186
target : $(Build.SourceVersion)
116
187
tagSource : auto
117
- assets : $(Build.SourcesDirectory )\vscode-arduino.vsix
188
+ assets : $(Build.StagingDirectory )\vscode-arduino.vsix
118
189
isPreRelease : $[contains(variables['Build.SourceBranch'], '-rc')]
119
190
condition : and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
191
+
192
+ - task : MicroBuildCleanup@1
193
+ displayName : Clean up MicroBuild
0 commit comments