@@ -65,7 +65,7 @@ private static int Main(string[] args)
6565 var addAssetSubOptions = baseSubOptions as AddAssetSubOptions ;
6666 if ( addAssetSubOptions != null )
6767 {
68- result = AddAssetAsync ( addAssetSubOptions ) . Result ;
68+ result = AddAssetsAsync ( addAssetSubOptions ) . Result ;
6969 }
7070 }
7171
@@ -130,7 +130,7 @@ private static async Task<int> CreateReleaseAsync(CreateSubOptions subOptions, I
130130 var github = subOptions . CreateGitHubClient ( ) ;
131131 var configuration = ConfigurationProvider . Provide ( subOptions . TargetPath , fileSystem ) ;
132132
133- await CreateRelease ( github , subOptions . RepositoryOwner , subOptions . RepositoryName , subOptions . Milestone , subOptions . TargetCommitish , subOptions . AssetPath , configuration ) ;
133+ await CreateRelease ( github , subOptions . RepositoryOwner , subOptions . RepositoryName , subOptions . Milestone , subOptions . TargetCommitish , subOptions . AssetPaths , configuration ) ;
134134
135135 return 0 ;
136136 }
@@ -142,13 +142,13 @@ private static async Task<int> CreateReleaseAsync(CreateSubOptions subOptions, I
142142 }
143143 }
144144
145- private static async Task < int > AddAssetAsync ( AddAssetSubOptions subOptions )
145+ private static async Task < int > AddAssetsAsync ( AddAssetSubOptions subOptions )
146146 {
147147 try
148148 {
149149 var github = subOptions . CreateGitHubClient ( ) ;
150150
151- await AddAsset ( github , subOptions . RepositoryOwner , subOptions . RepositoryName , subOptions . Milestone , subOptions . AssetPath ) ;
151+ await AddAssets ( github , subOptions . RepositoryOwner , subOptions . RepositoryName , subOptions . Milestone , subOptions . AssetPaths ) ;
152152
153153 return 0 ;
154154 }
@@ -222,7 +222,6 @@ private static async Task<int> ExportReleasesAsync(ExportSubOptions subOptions,
222222 }
223223 }
224224
225- private static async Task CreateRelease ( GitHubClient github , string owner , string repository , string milestone , string targetCommitish , string asset , Config configuration )
226225 {
227226 var releaseNotesBuilder = new ReleaseNotesBuilder ( new DefaultGitHubClient ( github , owner , repository ) , owner , repository , milestone , configuration ) ;
228227
@@ -234,22 +233,32 @@ private static async Task CreateRelease(GitHubClient github, string owner, strin
234233 Body = result ,
235234 Name = milestone
236235 } ;
236+
237237 if ( ! string . IsNullOrEmpty ( targetCommitish ) )
238238 {
239239 releaseUpdate . TargetCommitish = targetCommitish ;
240240 }
241241
242242 var release = await github . Release . Create ( owner , repository , releaseUpdate ) ;
243243
244- if ( File . Exists ( asset ) )
244+ foreach ( var asset in assets )
245245 {
246- var upload = new ReleaseAssetUpload { FileName = Path . GetFileName ( asset ) , ContentType = "application/octet-stream" , RawData = File . Open ( asset , FileMode . Open ) } ;
246+ if ( ! File . Exists ( asset ) )
247+ {
248+ continue ;
249+ }
250+
251+ var upload = new ReleaseAssetUpload
252+ {
253+ FileName = Path . GetFileName ( asset ) ,
254+ ContentType = "application/octet-stream" ,
255+ RawData = File . Open ( asset , FileMode . Open )
256+ } ;
247257
248258 await github . Release . UploadAsset ( release , upload ) ;
249259 }
250260 }
251261
252- private static async Task AddAsset ( GitHubClient github , string owner , string repository , string milestone , string assetPath )
253262 {
254263 var releases = await github . Release . GetAll ( owner , repository ) ;
255264
@@ -261,9 +270,19 @@ private static async Task AddAsset(GitHubClient github, string owner, string rep
261270 return ;
262271 }
263272
264- if ( File . Exists ( assetPath ) )
273+ foreach ( var assetPath in assetPaths )
265274 {
266- var upload = new ReleaseAssetUpload { FileName = Path . GetFileName ( assetPath ) , ContentType = "application/octet-stream" , RawData = File . Open ( assetPath , FileMode . Open ) } ;
275+ if ( ! File . Exists ( assetPath ) )
276+ {
277+ continue ;
278+ }
279+
280+ var upload = new ReleaseAssetUpload
281+ {
282+ FileName = Path . GetFileName ( assetPath ) ,
283+ ContentType = "application/octet-stream" ,
284+ RawData = File . Open ( assetPath , FileMode . Open )
285+ } ;
267286 await github . Release . UploadAsset ( release , upload ) ;
268287 }
269288 }
0 commit comments