mirror of
https://github.com/trympet/nextcloud-artifacts-action.git
synced 2025-04-24 20:16:08 +02:00
Merge branch 'v2' of github.com:trympet/nextcloud-artifacts-action
This commit is contained in:
commit
a496fd037d
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -367,6 +367,7 @@ class NextcloudArtifact {
|
|||||||
const client = new NextcloudClient_1.NextcloudClient(this.inputs.Endpoint, this.name, files.rootDirectory, this.inputs.Username, this.inputs.Password);
|
const client = new NextcloudClient_1.NextcloudClient(this.inputs.Endpoint, this.name, files.rootDirectory, this.inputs.Username, this.inputs.Password);
|
||||||
try {
|
try {
|
||||||
const shareableUrl = await client.uploadFiles(files.filesToUpload);
|
const shareableUrl = await client.uploadFiles(files.filesToUpload);
|
||||||
|
core.setOutput('SHAREABLE_URL', shareableUrl);
|
||||||
core.info(`Nextcloud shareable URL: ${shareableUrl}`);
|
core.info(`Nextcloud shareable URL: ${shareableUrl}`);
|
||||||
const resp = await this.octokit.rest.checks.update({
|
const resp = await this.octokit.rest.checks.update({
|
||||||
check_run_id: createResp.data.id,
|
check_run_id: createResp.data.id,
|
||||||
@ -495,10 +496,15 @@ class NextcloudClient {
|
|||||||
const spec = this.uploadSpec(files);
|
const spec = this.uploadSpec(files);
|
||||||
core.info('Zipping files...');
|
core.info('Zipping files...');
|
||||||
const zip = await this.zipFiles(spec);
|
const zip = await this.zipFiles(spec);
|
||||||
core.info('Uploading to Nextcloud...');
|
try {
|
||||||
const filePath = await this.upload(zip);
|
core.info('Uploading to Nextcloud...');
|
||||||
core.info(`Remote file path: ${filePath}`);
|
const filePath = await this.upload(zip);
|
||||||
return await this.shareFile(filePath);
|
core.info(`Remote file path: ${filePath}`);
|
||||||
|
return await this.shareFile(filePath);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
await fs.unlink(zip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uploadSpec(files) {
|
uploadSpec(files) {
|
||||||
const specifications = [];
|
const specifications = [];
|
||||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -42,11 +42,14 @@ export class NextcloudClient {
|
|||||||
const spec = this.uploadSpec(files)
|
const spec = this.uploadSpec(files)
|
||||||
core.info('Zipping files...')
|
core.info('Zipping files...')
|
||||||
const zip = await this.zipFiles(spec)
|
const zip = await this.zipFiles(spec)
|
||||||
|
try {
|
||||||
core.info('Uploading to Nextcloud...')
|
core.info('Uploading to Nextcloud...')
|
||||||
const filePath = await this.upload(zip)
|
const filePath = await this.upload(zip)
|
||||||
core.info(`Remote file path: ${filePath}`)
|
core.info(`Remote file path: ${filePath}`)
|
||||||
return await this.shareFile(filePath)
|
return await this.shareFile(filePath)
|
||||||
|
} finally {
|
||||||
|
await fs.unlink(zip)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private uploadSpec(files: string[]): FileSpec[] {
|
private uploadSpec(files: string[]): FileSpec[] {
|
||||||
@ -126,7 +129,7 @@ export class NextcloudClient {
|
|||||||
const remoteFilePath = `${remoteFileDir}/${this.artifact}.zip`
|
const remoteFilePath = `${remoteFileDir}/${this.artifact}.zip`
|
||||||
core.debug(`Transferring file... (${file})`)
|
core.debug(`Transferring file... (${file})`)
|
||||||
|
|
||||||
await this.davClient.putFileContents(remoteFilePath, await fs.readFile(file));
|
await this.davClient.putFileContents(remoteFilePath, await fs.readFile(file))
|
||||||
|
|
||||||
return remoteFilePath
|
return remoteFilePath
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user