mirror of
https://github.com/trympet/nextcloud-artifacts-action.git
synced 2025-04-24 20:16:08 +02:00
test
This commit is contained in:
parent
51f5e63425
commit
ab2bf8a4ac
1453
dist/index.js
vendored
1453
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
@ -153,7 +153,7 @@ export class NextcloudClient {
|
||||
})
|
||||
}
|
||||
|
||||
private async upload(file: string) {
|
||||
private async upload(file: string): Promise<string> {
|
||||
const remoteFileDir = `/artifacts/${this.guid}`;
|
||||
core.info("Checking directory...");
|
||||
if (!(await this.davClient.exists(remoteFileDir))) {
|
||||
@ -164,6 +164,13 @@ export class NextcloudClient {
|
||||
const remoteFilePath = `${remoteFileDir}/${this.artifact}.zip`;
|
||||
core.info(`Transferring file... (${file})`);
|
||||
|
||||
await this.transferFile(remoteFilePath, file);
|
||||
|
||||
core.info("finish");
|
||||
return remoteFilePath;
|
||||
}
|
||||
|
||||
private transferFile(remoteFilePath: string, file: string): Promise<[void, void]> {
|
||||
const remoteStream = this.davClient.createWriteStream(remoteFilePath);
|
||||
const remoteStreamPromise = new Promise<void>((resolve, reject) => {
|
||||
remoteStream.on('error', () => reject("Failed to upload file"))
|
||||
@ -175,13 +182,10 @@ export class NextcloudClient {
|
||||
fileStream.on('error', () => reject("Failed to read file"))
|
||||
.on('end', () => resolve());
|
||||
});
|
||||
|
||||
|
||||
fileStream.pipe(remoteStream);
|
||||
|
||||
await Promise.all([remoteStreamPromise, fileStreamPromise]);
|
||||
|
||||
core.info("finish");
|
||||
return remoteFilePath;
|
||||
return Promise.all([remoteStreamPromise, fileStreamPromise]);
|
||||
}
|
||||
|
||||
private async shareFile(remoteFilePath: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user