@@ -257,7 +257,7 @@ private static async Task CreateReleaseFromInputFile(GitHubClient github, string
257257 await AddAssets ( github , assets , release ) ;
258258 }
259259
260- private static async Task AddAssets ( GitHubClient github , string owner , string repository , string tagName , IList < string > assetPaths )
260+ private static async Task AddAssets ( GitHubClient github , string owner , string repository , string tagName , IList < string > assets )
261261 {
262262 var releases = await github . Release . GetAll ( owner , repository ) ;
263263
@@ -269,21 +269,7 @@ private static async Task AddAssets(GitHubClient github, string owner, string re
269269 return ;
270270 }
271271
272- foreach ( var assetPath in assetPaths )
273- {
274- if ( ! File . Exists ( assetPath ) )
275- {
276- continue ;
277- }
278-
279- var upload = new ReleaseAssetUpload
280- {
281- FileName = Path . GetFileName ( assetPath ) ,
282- ContentType = "application/octet-stream" ,
283- RawData = File . Open ( assetPath , FileMode . Open )
284- } ;
285- await github . Release . UploadAsset ( release , upload ) ;
286- }
272+ await AddAssets ( github , assets , release ) ;
287273 }
288274
289275 private static async Task < string > ExportReleases ( GitHubClient github , string owner , string repository , string tagName , Config configuration )
@@ -329,21 +315,24 @@ private static async Task PublishRelease(GitHubClient github, string owner, stri
329315
330316 private static async Task AddAssets ( GitHubClient github , IList < string > assets , Release release )
331317 {
332- foreach ( var asset in assets )
318+ if ( assets != null )
333319 {
334- if ( ! File . Exists ( asset ) )
320+ foreach ( var asset in assets )
335321 {
336- continue ;
337- }
322+ if ( ! File . Exists ( asset ) )
323+ {
324+ continue ;
325+ }
338326
339- var upload = new ReleaseAssetUpload
340- {
341- FileName = Path . GetFileName ( asset ) ,
342- ContentType = "application/octet-stream" ,
343- RawData = File . Open ( asset , FileMode . Open )
344- } ;
327+ var upload = new ReleaseAssetUpload
328+ {
329+ FileName = Path . GetFileName ( asset ) ,
330+ ContentType = "application/octet-stream" ,
331+ RawData = File . Open ( asset , FileMode . Open )
332+ } ;
345333
346- await github . Release . UploadAsset ( release , upload ) ;
334+ await github . Release . UploadAsset ( release , upload ) ;
335+ }
347336 }
348337 }
349338
0 commit comments