mirror of
https://github.com/trympet/nextcloud-artifacts-action.git
synced 2025-04-24 20:16:08 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7c9fa20219 | ||
![]() |
3d18ab00c5 | ||
![]() |
20dadea389 | ||
![]() |
a496fd037d | ||
![]() |
61ff55deae | ||
![]() |
b357f186aa | ||
![]() |
dec03f56e0 | ||
![]() |
62e99ad6b2 | ||
![]() |
5825f9614a | ||
![]() |
e1264cbb56 |
@ -1,5 +1,5 @@
|
||||
# Nextcloud Artifact Upload Action
|
||||
Upload artifacts to nextcloud and outputs a shareable URL.
|
||||
Upload artifacts to nextcloud and output a shareable URL.
|
||||
|
||||
### How it looks:
|
||||

|
||||
@ -23,7 +23,7 @@ jobs:
|
||||
with:
|
||||
name: 'my-artifact' # Name of the artifact
|
||||
path: 'bin/**/*.exe' # Globbing supported
|
||||
nextcloud-url: 'https://nextcloud.example.com' # Format of test results
|
||||
nextcloud-url: 'https://nextcloud.example.com' # Nextcloud URL
|
||||
nextcloud-username: ${{ secrets.NEXTCLOUD_USERNAME }} # Username from repository secret
|
||||
nextcloud-password: ${{ secrets.NEXTCLOUD_PASSWORD }} # Password from repository secret
|
||||
```
|
||||
|
@ -30,5 +30,5 @@ inputs:
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
17
dist/index.js
vendored
17
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);
|
||||
try {
|
||||
const shareableUrl = await client.uploadFiles(files.filesToUpload);
|
||||
core.setOutput('SHAREABLE_URL', shareableUrl);
|
||||
core.info(`Nextcloud shareable URL: ${shareableUrl}`);
|
||||
const resp = await this.octokit.rest.checks.update({
|
||||
check_run_id: createResp.data.id,
|
||||
@ -486,7 +487,8 @@ class NextcloudClient {
|
||||
this.headers = { Authorization: 'Basic ' + Buffer.from(`${this.username}:${this.password}`).toString('base64') };
|
||||
this.davClient = webdav.createClient(`${this.endpoint.href}remote.php/dav/files/${this.username}`, {
|
||||
username: this.username,
|
||||
password: this.password
|
||||
password: this.password,
|
||||
maxBodyLength: 1024 ** 3
|
||||
});
|
||||
}
|
||||
async uploadFiles(files) {
|
||||
@ -494,10 +496,15 @@ class NextcloudClient {
|
||||
const spec = this.uploadSpec(files);
|
||||
core.info('Zipping files...');
|
||||
const zip = await this.zipFiles(spec);
|
||||
core.info('Uploading to Nextcloud...');
|
||||
const filePath = await this.upload(zip);
|
||||
core.info(`Remote file path: ${filePath}`);
|
||||
return await this.shareFile(filePath);
|
||||
try {
|
||||
core.info('Uploading to Nextcloud...');
|
||||
const filePath = await this.upload(zip);
|
||||
core.info(`Remote file path: ${filePath}`);
|
||||
return await this.shareFile(filePath);
|
||||
}
|
||||
finally {
|
||||
await fs.unlink(zip);
|
||||
}
|
||||
}
|
||||
uploadSpec(files) {
|
||||
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
@ -83,6 +83,7 @@ export class NextcloudArtifact {
|
||||
|
||||
try {
|
||||
const shareableUrl = await client.uploadFiles(files.filesToUpload)
|
||||
core.setOutput('SHAREABLE_URL', shareableUrl)
|
||||
core.info(`Nextcloud shareable URL: ${shareableUrl}`)
|
||||
const resp = await this.octokit.rest.checks.update({
|
||||
check_run_id: createResp.data.id,
|
||||
|
@ -42,11 +42,14 @@ export class NextcloudClient {
|
||||
const spec = this.uploadSpec(files)
|
||||
core.info('Zipping files...')
|
||||
const zip = await this.zipFiles(spec)
|
||||
|
||||
core.info('Uploading to Nextcloud...')
|
||||
const filePath = await this.upload(zip)
|
||||
core.info(`Remote file path: ${filePath}`)
|
||||
return await this.shareFile(filePath)
|
||||
try {
|
||||
core.info('Uploading to Nextcloud...')
|
||||
const filePath = await this.upload(zip)
|
||||
core.info(`Remote file path: ${filePath}`)
|
||||
return await this.shareFile(filePath)
|
||||
} finally {
|
||||
await fs.unlink(zip)
|
||||
}
|
||||
}
|
||||
|
||||
private uploadSpec(files: string[]): FileSpec[] {
|
||||
@ -126,7 +129,7 @@ export class NextcloudClient {
|
||||
const remoteFilePath = `${remoteFileDir}/${this.artifact}.zip`
|
||||
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user