@@ -65,7 +65,7 @@ private static int Main(string[] args)
65
65
var addAssetSubOptions = baseSubOptions as AddAssetSubOptions ;
66
66
if ( addAssetSubOptions != null )
67
67
{
68
- result = AddAssetAsync ( addAssetSubOptions ) . Result ;
68
+ result = AddAssetsAsync ( addAssetSubOptions ) . Result ;
69
69
}
70
70
}
71
71
@@ -130,7 +130,7 @@ private static async Task<int> CreateReleaseAsync(CreateSubOptions subOptions, I
130
130
var github = subOptions . CreateGitHubClient ( ) ;
131
131
var configuration = ConfigurationProvider . Provide ( subOptions . TargetPath , fileSystem ) ;
132
132
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 ) ;
134
134
135
135
return 0 ;
136
136
}
@@ -142,13 +142,13 @@ private static async Task<int> CreateReleaseAsync(CreateSubOptions subOptions, I
142
142
}
143
143
}
144
144
145
- private static async Task < int > AddAssetAsync ( AddAssetSubOptions subOptions )
145
+ private static async Task < int > AddAssetsAsync ( AddAssetSubOptions subOptions )
146
146
{
147
147
try
148
148
{
149
149
var github = subOptions . CreateGitHubClient ( ) ;
150
150
151
- await AddAsset ( github , subOptions . RepositoryOwner , subOptions . RepositoryName , subOptions . Milestone , subOptions . AssetPath ) ;
151
+ await AddAssets ( github , subOptions . RepositoryOwner , subOptions . RepositoryName , subOptions . Milestone , subOptions . AssetPaths ) ;
152
152
153
153
return 0 ;
154
154
}
@@ -222,7 +222,6 @@ private static async Task<int> ExportReleasesAsync(ExportSubOptions subOptions,
222
222
}
223
223
}
224
224
225
- private static async Task CreateRelease ( GitHubClient github , string owner , string repository , string milestone , string targetCommitish , string asset , Config configuration )
226
225
{
227
226
var releaseNotesBuilder = new ReleaseNotesBuilder ( new DefaultGitHubClient ( github , owner , repository ) , owner , repository , milestone , configuration ) ;
228
227
@@ -234,22 +233,32 @@ private static async Task CreateRelease(GitHubClient github, string owner, strin
234
233
Body = result ,
235
234
Name = milestone
236
235
} ;
236
+
237
237
if ( ! string . IsNullOrEmpty ( targetCommitish ) )
238
238
{
239
239
releaseUpdate . TargetCommitish = targetCommitish ;
240
240
}
241
241
242
242
var release = await github . Release . Create ( owner , repository , releaseUpdate ) ;
243
243
244
- if ( File . Exists ( asset ) )
244
+ foreach ( var asset in assets )
245
245
{
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
+ } ;
247
257
248
258
await github . Release . UploadAsset ( release , upload ) ;
249
259
}
250
260
}
251
261
252
- private static async Task AddAsset ( GitHubClient github , string owner , string repository , string milestone , string assetPath )
253
262
{
254
263
var releases = await github . Release . GetAll ( owner , repository ) ;
255
264
@@ -261,9 +270,19 @@ private static async Task AddAsset(GitHubClient github, string owner, string rep
261
270
return ;
262
271
}
263
272
264
- if ( File . Exists ( assetPath ) )
273
+ foreach ( var assetPath in assetPaths )
265
274
{
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
+ } ;
267
286
await github . Release . UploadAsset ( release , upload ) ;
268
287
}
269
288
}
0 commit comments