diff --git a/packages/artifact/src/artifact-client.ts b/packages/artifact/src/artifact-client.ts index 2be551ad..4053266e 100644 --- a/packages/artifact/src/artifact-client.ts +++ b/packages/artifact/src/artifact-client.ts @@ -1,6 +1,6 @@ -import { ArtifactClient, DefaultArtifactClient} from './internal/artifact-client' -import { UploadOptions } from './internal/upload-options' -import { UploadResponse } from './internal/upload-response' +import { ArtifactClient, DefaultArtifactClient} from './internal/internal-artifact-client' +import { UploadOptions } from './internal/upload/upload-options' +import { UploadResponse } from './internal/upload/upload-response' /** * Exported functionality that we want to expose for any users of @actions/artifact diff --git a/packages/artifact/src/internal/artifact-client.ts b/packages/artifact/src/internal/internal-artifact-client.ts similarity index 65% rename from packages/artifact/src/internal/artifact-client.ts rename to packages/artifact/src/internal/internal-artifact-client.ts index c3f3c8dd..94b16376 100644 --- a/packages/artifact/src/internal/artifact-client.ts +++ b/packages/artifact/src/internal/internal-artifact-client.ts @@ -1,6 +1,6 @@ -import {checkArtifactName} from './path-and-artifact-name-validation' -import {UploadOptions} from './upload-options' -import {UploadResponse} from './upload-response' +import { UploadOptions } from './upload/upload-options' +import { UploadResponse } from './upload/upload-response' +import { uploadArtifact } from './upload/upload-artifact' export interface ArtifactClient { /** @@ -39,22 +39,6 @@ export class DefaultArtifactClient implements ArtifactClient { rootDirectory: string, options?: UploadOptions | undefined ): Promise { - - // Need to keep checking the artifact name - checkArtifactName(name) - - // TODO Twirp call to create new artifact - - // TODO Upload to blob storage using SAS URL - - // TODO Twirp call to finalize the new artifact upload - - const uploadResponse: UploadResponse = { - artifactName: name, - artifactItems: [], - size: 0 - } - - return uploadResponse + return uploadArtifact(name, files, rootDirectory, options) } } \ No newline at end of file diff --git a/packages/artifact/src/internal/path-and-artifact-name-validation.ts b/packages/artifact/src/internal/upload/path-and-artifact-name-validation.ts similarity index 100% rename from packages/artifact/src/internal/path-and-artifact-name-validation.ts rename to packages/artifact/src/internal/upload/path-and-artifact-name-validation.ts diff --git a/packages/artifact/src/internal/upload/upload-artifact.ts b/packages/artifact/src/internal/upload/upload-artifact.ts new file mode 100644 index 00000000..238b7790 --- /dev/null +++ b/packages/artifact/src/internal/upload/upload-artifact.ts @@ -0,0 +1,29 @@ + +import {checkArtifactName} from './path-and-artifact-name-validation' +import {UploadOptions} from './upload-options' +import {UploadResponse} from './upload-response' + +export async function uploadArtifact( + name: string, + files: string[], + rootDirectory: string, + options?: UploadOptions | undefined + ): Promise { + + // Need to keep checking the artifact name + checkArtifactName(name) + + // TODO Twirp call to create new artifact + + // TODO Upload to blob storage using SAS URL + + // TODO Twirp call to finalize the new artifact upload + + const uploadResponse: UploadResponse = { + artifactName: name, + artifactItems: [], + size: 0 + } + + return uploadResponse +} \ No newline at end of file diff --git a/packages/artifact/src/internal/upload-options.ts b/packages/artifact/src/internal/upload/upload-options.ts similarity index 100% rename from packages/artifact/src/internal/upload-options.ts rename to packages/artifact/src/internal/upload/upload-options.ts diff --git a/packages/artifact/src/internal/upload-response.ts b/packages/artifact/src/internal/upload/upload-response.ts similarity index 100% rename from packages/artifact/src/internal/upload-response.ts rename to packages/artifact/src/internal/upload/upload-response.ts