mirror of
https://github.com/trympet/nextcloud-artifacts-action.git
synced 2025-04-25 12:36:07 +02:00
Compare commits
No commits in common. "master" and "v2.0.2" have entirely different histories.
@ -1,5 +1,5 @@
|
|||||||
# Nextcloud Artifact Upload Action
|
# Nextcloud Artifact Upload Action
|
||||||
Upload artifacts to nextcloud and output a shareable URL.
|
Upload artifacts to nextcloud and outputs a shareable URL.
|
||||||
|
|
||||||
### How it looks:
|
### How it looks:
|
||||||

|

|
||||||
@ -23,7 +23,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: 'my-artifact' # Name of the artifact
|
name: 'my-artifact' # Name of the artifact
|
||||||
path: 'bin/**/*.exe' # Globbing supported
|
path: 'bin/**/*.exe' # Globbing supported
|
||||||
nextcloud-url: 'https://nextcloud.example.com' # Nextcloud URL
|
nextcloud-url: 'https://nextcloud.example.com' # Format of test results
|
||||||
nextcloud-username: ${{ secrets.NEXTCLOUD_USERNAME }} # Username from repository secret
|
nextcloud-username: ${{ secrets.NEXTCLOUD_USERNAME }} # Username from repository secret
|
||||||
nextcloud-password: ${{ secrets.NEXTCLOUD_PASSWORD }} # Password from repository secret
|
nextcloud-password: ${{ secrets.NEXTCLOUD_PASSWORD }} # Password from repository secret
|
||||||
```
|
```
|
||||||
|
@ -30,5 +30,5 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
17
dist/index.js
vendored
17
dist/index.js
vendored
@ -367,7 +367,6 @@ 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,
|
||||||
@ -487,8 +486,7 @@ class NextcloudClient {
|
|||||||
this.headers = { Authorization: 'Basic ' + Buffer.from(`${this.username}:${this.password}`).toString('base64') };
|
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}`, {
|
this.davClient = webdav.createClient(`${this.endpoint.href}remote.php/dav/files/${this.username}`, {
|
||||||
username: this.username,
|
username: this.username,
|
||||||
password: this.password,
|
password: this.password
|
||||||
maxBodyLength: 1024 ** 3
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async uploadFiles(files) {
|
async uploadFiles(files) {
|
||||||
@ -496,15 +494,10 @@ 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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
@ -83,7 +83,6 @@ export class NextcloudArtifact {
|
|||||||
|
|
||||||
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,
|
||||||
|
@ -42,14 +42,11 @@ 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[] {
|
||||||
@ -129,7 +126,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