mirror of
https://github.com/ViViDboarder/drone-webdav.git
synced 2026-06-16 14:49:31 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d66c38714 | |||
| 9693473c95 | |||
| 133bfd843d | |||
| c61ba9725f | |||
| e1aadcea34 | |||
| 48079a250f | |||
| 71e9fdd0f3 | |||
| 95b0ef6abf | |||
| 5d84b40f1c | |||
| b7a984ed39 | |||
| d9d0424b9f |
@@ -40,9 +40,9 @@ jobs:
|
|||||||
# https://github.com/sigstore/cosign-installer
|
# https://github.com/sigstore/cosign-installer
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: sigstore/cosign-installer@7e0881f8fe90b25e305bbf0309761e9314607e25
|
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06
|
||||||
with:
|
with:
|
||||||
cosign-release: 'v1.9.0'
|
cosign-release: 'v2.1.1'
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
@@ -101,4 +101,4 @@ jobs:
|
|||||||
COSIGN_EXPERIMENTAL: "true"
|
COSIGN_EXPERIMENTAL: "true"
|
||||||
# This step uses the identity token to provision an ephemeral certificate
|
# This step uses the identity token to provision an ephemeral certificate
|
||||||
# against the sigstore community Fulcio instance.
|
# against the sigstore community Fulcio instance.
|
||||||
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
|
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
FROM alpine:3.16
|
FROM alpine:3.17
|
||||||
|
|
||||||
RUN apk --no-cache add bash=~5.1 curl=~7.83 ca-certificates=~20220614
|
RUN apk --no-cache add bash=~5 curl=~8 ca-certificates=~20230506
|
||||||
COPY push.sh /bin/
|
COPY push.sh /bin/
|
||||||
RUN chmod +x /bin/push.sh
|
RUN chmod +x /bin/push.sh
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# drone-webdav
|
# drone-webdav
|
||||||
A WebDAV plugin, for the drone.io project, which allows you to push build artifacts to any WebDAV server, including Nextcloud or ownCloud.
|
|
||||||
|
A [Drone CI](https://www.drone.io/) / [Woodpecker CI](https://woodpecker-ci.org/) plugin, that will allow pushing build artifacts to any WebDAV server, including Nextcloud or ownCloud.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ pipeline:
|
|||||||
settings:
|
settings:
|
||||||
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
|
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
|
||||||
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
|
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
|
||||||
user: myusername
|
username: myusername
|
||||||
password: mypassword
|
password: mypassword
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -25,18 +26,18 @@ pipeline:
|
|||||||
settings:
|
settings:
|
||||||
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
|
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
|
||||||
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
|
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
|
||||||
secrets:
|
username:
|
||||||
- source: WEBDAV_USER
|
from_secret: WEBDAV_USER
|
||||||
target: PLUGIN_USERNAME
|
password:
|
||||||
- source: WEBDAV_PASSWORD
|
from_secret: WEBDAV_PASSWORD
|
||||||
target: PLUGIN_PASSWORD
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
#### How do I upload multiple files at once?
|
### How do I upload multiple files at once?
|
||||||
Since this script uses **curl** to upload your files, you can use it's corresponding syntax.<br>
|
|
||||||
An example, taken from the official [documentation](https://curl.haxx.se/docs/manpage.html#-T), would be to pass ``{dogs.png,cats.jpg}`` to ``PLUGIN_FILE``.
|
Since this script uses **curl** to upload your files, you can use it's corresponding syntax.
|
||||||
|
An example, taken from the official [documentation](https://curl.se/docs/manpage.html#-T), would be to pass ``{dogs.png,cats.jpg}`` to ``PLUGIN_FILE``.
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
|
||||||
@@ -49,11 +50,12 @@ The following environment variables can be used for further cutomization:
|
|||||||
| ``PLUGIN_ATTEMPTS`` | Defines how often a failed upload should be retried. Normally there is only one upload attempt. |
|
| ``PLUGIN_ATTEMPTS`` | Defines how often a failed upload should be retried. Normally there is only one upload attempt. |
|
||||||
| ``PLUGIN_CUSTOM_ARGUMENTS`` | Additional arguments to be passed to `curl`. |
|
| ``PLUGIN_CUSTOM_ARGUMENTS`` | Additional arguments to be passed to `curl`. |
|
||||||
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
There are only two tests right now and they are configured using Docker Compose. To run them, just use
|
There are only two tests right now and they are configured using Docker Compose. To run them, just use
|
||||||
|
|
||||||
make test
|
```sh
|
||||||
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
If someone wants to make this better (or add a Drone file) I'd gladly accept the patch.
|
If someone wants to make this better (or add a Drone file) I'd gladly accept the patch.
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
name: WebDAV
|
||||||
|
description: plugin to publish any artifacts to any WebDAV server
|
||||||
|
author: vividboarder
|
||||||
|
tags: [deploy, publish]
|
||||||
|
containerImage: vividboarder/drone-webdav
|
||||||
|
containerImageUrl: https://hub.docker.com/r/vividboarder/drone-webdav
|
||||||
|
url: https://github.com/vividboarder/drone-webdav
|
||||||
|
---
|
||||||
|
|
||||||
|
A [Drone CI](https://www.drone.io/) / [Woodpecker CI](https://woodpecker-ci.org/) plugin,
|
||||||
|
that will allow pushing build artifacts to any [WebDAV](http://www.webdav.org/) server, including Nextcloud or ownCloud.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Upload multiple files
|
||||||
|
- Use a proxy
|
||||||
|
- Retry on fail
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
| Settings Name | Required | Description
|
||||||
|
| ------------------ |--------- | --------------------------------------------
|
||||||
|
| `file` | **✓** | File(s) to upload. Use [curl syntax](https://curl.se/docs/manpage.html#-T) for multiple (e.g. `{dogs.png,cats.jpg}`)
|
||||||
|
| `destination` | **✓** | The WebDav **folder** url
|
||||||
|
| `username` | **✓** | The WebDav-**User** to use
|
||||||
|
| `password` | | The **Password** for the WebDav-User
|
||||||
|
| `proxy_url` | | May be used to specify a proxy (e.g. `socks5://{ip_address}:{port}`
|
||||||
|
| `timeout` | | Defines a timeout (in seconds) to stop the upload after a certain time
|
||||||
|
| `attempts` | | Defines how often a failed upload should be retried. Normally there is only one upload attempt
|
||||||
|
| `custom_arguments` | | Additional arguments to be passed to [`curl`](https://curl.se/)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
pipeline:
|
||||||
|
upload_debug:
|
||||||
|
image: vividboarder/drone-webdav
|
||||||
|
settings:
|
||||||
|
file: com.vividboarder.otbeta/build/outputs/apk/com.vividboarder.otbeta-debug.apk
|
||||||
|
destination: https://my.nextcloud.com/remote.php/dav/files/vividboarder/Android/Apks/
|
||||||
|
username:
|
||||||
|
from_secret: WEBDAV_USER
|
||||||
|
password:
|
||||||
|
from_secret: WEBDAV_PASSWORD
|
||||||
|
```
|
||||||
@@ -36,8 +36,16 @@ fi
|
|||||||
# Repeat the upload as long as specified.
|
# Repeat the upload as long as specified.
|
||||||
while [ "${PLUGIN_ATTEMPTS}" -gt 0 ]; do
|
while [ "${PLUGIN_ATTEMPTS}" -gt 0 ]; do
|
||||||
|
|
||||||
# Uploading the file
|
# Uploading the file
|
||||||
curl --fail-with-body --show-error --silent "${ARGS[@]}" --upload-file "$PLUGIN_FILE" "$PLUGIN_DESTINATION" && {
|
# shellcheck disable=SC2086
|
||||||
|
curl \
|
||||||
|
$PLUGIN_CUSTOM_ARGUMENTS \
|
||||||
|
--fail-with-body \
|
||||||
|
--show-error \
|
||||||
|
--silent \
|
||||||
|
"${ARGS[@]}" \
|
||||||
|
--upload-file "$PLUGIN_FILE" \
|
||||||
|
"$PLUGIN_DESTINATION" && {
|
||||||
# Terminate the script as soon as the upload is successful
|
# Terminate the script as soon as the upload is successful
|
||||||
echo "[INFO] Upload was successful."
|
echo "[INFO] Upload was successful."
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user