1
0
Fork 0

Restructuring

artifact-next
Konrad Pabjan 2023-08-01 11:21:35 -04:00
parent 95cf02468e
commit 962fd91d75
6 changed files with 36 additions and 23 deletions

View File

@ -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

View File

@ -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<UploadResponse> {
// 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)
}
}

View File

@ -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<UploadResponse> {
// 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
}