@@ -15,8 +15,9 @@ namespace GitHubReleaseManager.Cli
1515 using System . Threading . Tasks ;
1616 using CommandLine ;
1717 using GitHubReleaseManager . Cli . Options ;
18- using GitHubReleaseManager . Configuration ;
19- using GitHubReleaseManager . Helpers ;
18+ using GitHubReleaseManager . Core ;
19+ using GitHubReleaseManager . Core . Configuration ;
20+ using GitHubReleaseManager . Core . Helpers ;
2021 using Octokit ;
2122 using FileMode = System . IO . FileMode ;
2223
@@ -256,7 +257,7 @@ private static async Task CreateReleaseFromInputFile(GitHubClient github, string
256257 await AddAssets ( github , assets , release ) ;
257258 }
258259
259- 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 )
260261 {
261262 var releases = await github . Release . GetAll ( owner , repository ) ;
262263
@@ -268,21 +269,7 @@ private static async Task AddAssets(GitHubClient github, string owner, string re
268269 return ;
269270 }
270271
271- foreach ( var assetPath in assetPaths )
272- {
273- if ( ! File . Exists ( assetPath ) )
274- {
275- continue ;
276- }
277-
278- var upload = new ReleaseAssetUpload
279- {
280- FileName = Path . GetFileName ( assetPath ) ,
281- ContentType = "application/octet-stream" ,
282- RawData = File . Open ( assetPath , FileMode . Open )
283- } ;
284- await github . Release . UploadAsset ( release , upload ) ;
285- }
272+ await AddAssets ( github , assets , release ) ;
286273 }
287274
288275 private static async Task < string > ExportReleases ( GitHubClient github , string owner , string repository , string tagName , Config configuration )
@@ -328,21 +315,24 @@ private static async Task PublishRelease(GitHubClient github, string owner, stri
328315
329316 private static async Task AddAssets ( GitHubClient github , IList < string > assets , Release release )
330317 {
331- foreach ( var asset in assets )
318+ if ( assets != null )
332319 {
333- if ( ! File . Exists ( asset ) )
320+ foreach ( var asset in assets )
334321 {
335- continue ;
336- }
322+ if ( ! File . Exists ( asset ) )
323+ {
324+ continue ;
325+ }
337326
338- var upload = new ReleaseAssetUpload
339- {
340- FileName = Path . GetFileName ( asset ) ,
341- ContentType = "application/octet-stream" ,
342- RawData = File . Open ( asset , FileMode . Open )
343- } ;
327+ var upload = new ReleaseAssetUpload
328+ {
329+ FileName = Path . GetFileName ( asset ) ,
330+ ContentType = "application/octet-stream" ,
331+ RawData = File . Open ( asset , FileMode . Open )
332+ } ;
344333
345- await github . Release . UploadAsset ( release , upload ) ;
334+ await github . Release . UploadAsset ( release , upload ) ;
335+ }
346336 }
347337 }
348338
0 commit comments