@@ -90,11 +90,26 @@ steps:
90
90
TargetFolder : ' $(Build.ArtifactStagingDirectory)'
91
91
flattenFolders : true
92
92
93
+ # find if there are NuGet artifacts
94
+ - task : PowerShell@2
95
+ displayName : Count artifacts
96
+ name : Count_Artifacts
97
+ inputs :
98
+ workingDirectory : ' $(Build.ArtifactStagingDirectory)'
99
+ targetType : inline
100
+ script : |
101
+ $count = (Get-ChildItem -Path '.' -Filter '*.nupkg' -Recurse).Count
102
+ Write-Host $count + ' NuGet packages found'
103
+
104
+ # set variable to forward
105
+ echo "##vso[task.setvariable variable=NUGET_COUNT;isOutput=true]$count"
106
+
93
107
- task : DotNetCoreCLI@2
94
108
displayName : Install SignTool tool
95
109
condition : >-
96
110
and(
97
111
succeeded(),
112
+ gt(variables.NUGET_COUNT, 0),
98
113
eq(variables['System.PullRequest.PullRequestId'], '')
99
114
)
100
115
inputs :
@@ -115,9 +130,14 @@ steps:
115
130
--descriptionUrl "https://github.com/$env:Build_Repository_Name"
116
131
displayName : Sign packages
117
132
continueOnError : true
118
- condition : and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], '') )
133
+ condition : >-
134
+ and(
135
+ succeeded(),
136
+ gt(variables.NUGET_COUNT, 0),
137
+ eq(variables['System.PullRequest.PullRequestId'], '')
138
+ )
119
139
120
- # publish artifacts (only possible if this is not a PR originated on a fork)
140
+ # publish artifacts
121
141
- task : PublishBuildArtifacts@1
122
142
condition : succeeded()
123
143
displayName : Publish deployables artifacts
@@ -136,6 +156,7 @@ steps:
136
156
condition : >-
137
157
and(
138
158
succeeded(),
159
+ gt(variables.NUGET_COUNT, 0),
139
160
eq(variables['System.PullRequest.PullRequestId'], '')
140
161
)
141
162
continueOnError : false
@@ -147,6 +168,7 @@ steps:
147
168
condition : >-
148
169
and(
149
170
succeeded(),
171
+ gt(variables.NUGET_COUNT, 0),
150
172
eq(variables['System.PullRequest.PullRequestId'], '')
151
173
)
152
174
continueOnError : false
@@ -157,6 +179,7 @@ steps:
157
179
condition : >-
158
180
and(
159
181
succeeded(),
182
+ gt(variables.NUGET_COUNT, 0),
160
183
eq(variables['System.PullRequest.PullRequestId'], '')
161
184
)
162
185
inputs :
@@ -166,12 +189,13 @@ steps:
166
189
workingDirectory : ' nanoFramework.IoT.Device'
167
190
168
191
- task : PowerShell@2
192
+ displayName : Push READMEs to GitHub
169
193
condition : >-
170
194
and(
171
195
succeeded(),
196
+ gt(variables.NUGET_COUNT, 0),
172
197
eq(variables['System.PullRequest.PullRequestId'], '')
173
198
)
174
- displayName : Push READMEs to GitHub
175
199
continueOnError : true
176
200
inputs :
177
201
workingDirectory : ' nanoFramework.IoT.Device'
0 commit comments