Fixes #1 Allow for multiple artifacts
This commit is contained in:
24
src/ArtifactUploader.ts
Normal file
24
src/ArtifactUploader.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Artifact } from "./Artifact";
|
||||
import { Releases } from "./Releases";
|
||||
|
||||
export interface ArtifactUploader {
|
||||
uploadArtifacts(artifacts: Artifact[], uploadUrl: string): void
|
||||
}
|
||||
|
||||
export class GithubArtifactUploader implements ArtifactUploader {
|
||||
private releases: Releases
|
||||
|
||||
constructor(releases: Releases) {
|
||||
this.releases = releases
|
||||
}
|
||||
|
||||
async uploadArtifacts(artifacts: Artifact[], uploadUrl: string) {
|
||||
artifacts.forEach(async artifact => {
|
||||
await this.releases.uploadArtifact(uploadUrl,
|
||||
artifact.contentLength,
|
||||
artifact.contentType,
|
||||
artifact.readFile(),
|
||||
artifact.name)
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user