Compare commits

...

9 Commits

Author SHA1 Message Date
TrymPet
7c9fa20219
Merge pull request #2 from stilobique/master
Update dependency
2024-02-12 11:30:21 +01:00
Aurelien Vaillant
3d18ab00c5
Merge pull request #1 from stilobique/upgrade-node-vs
Update action.yml
2024-02-10 16:41:13 +01:00
Aurelien Vaillant
20dadea389
Update action.yml 2024-02-10 16:12:30 +01:00
Trym Lund Flogard
a496fd037d Merge branch 'v2' of github.com:trympet/nextcloud-artifacts-action 2021-11-14 18:43:47 +01:00
Trym Lund Flogard
61ff55deae format 2021-11-14 18:43:26 +01:00
Trym Lund Flogard
b357f186aa delete temp file after zip 2021-11-14 18:42:22 +01:00
TrymPet
dec03f56e0
Update README.md 2021-07-15 01:35:30 +02:00
TrymPet
62e99ad6b2
Merge pull request #1 from dojineko/set-output
set output SHAREABLE_URL
2021-06-18 20:05:05 +02:00
dojineko
5825f9614a set output SHAREABLE_URL 2021-06-19 01:32:53 +09:00
6 changed files with 25 additions and 15 deletions

View File

@ -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:
![image](https://user-images.githubusercontent.com/23460729/120891750-7f247380-c60a-11eb-9998-3b3b7f61066f.png)
@ -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
```

View File

@ -30,5 +30,5 @@ inputs:
required: false
default: ${{ github.token }}
runs:
using: 'node12'
main: 'dist/index.js'
using: 'node20'
main: 'dist/index.js'

14
dist/index.js vendored
View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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