A Drone plugin to push files to webdav
Go to file
ViViDboarder 71e9fdd0f3 Add unquoted custom args back in
This requires disabling shellcheck for the whole line. I haven't yet been
able to find a way to let the shell parse out args into an array with
quotes.
2023-07-25 15:04:19 -07:00
.github/workflows Fail build when upload fails 2022-08-10 15:25:05 -07:00
tests Fail build when upload fails 2022-08-10 15:25:05 -07:00
.dockerignore Defaults to WEBDAV_* for username and password if not provided (#1) 2018-04-12 10:49:56 -07:00
.pre-commit-config.yaml Add pre-commit hooks 2020-05-19 13:38:40 -07:00
Dockerfile Switch to latest version of Alpine and fix intersection 2022-08-10 15:01:37 -07:00
Makefile Add `all` make target for test and lint 2020-05-19 13:52:36 -07:00
Readme.md Fix user->username in Readme.md examples 2023-06-29 19:54:28 +02:00
docs.md Fix documentation (#18) 2023-05-20 10:43:57 -07:00
push.sh Add unquoted custom args back in 2023-07-25 15:04:19 -07:00

Readme.md

drone-webdav

A Drone CI / Woodpecker CI plugin, that will allow pushing build artifacts to any WebDAV server, including Nextcloud or ownCloud.

Examples

An example configuration would be as follows:

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: myusername
      password: mypassword

You probably don't want to check your credentials into your repo, so you may use secrets for this:

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

FAQ

How do I upload multiple files at once?

Since this script uses curl to upload your files, you can use it's corresponding syntax.
An example, taken from the official documentation, would be to pass {dogs.png,cats.jpg} to PLUGIN_FILE.

Customization

The following environment variables can be used for further cutomization:

Variable Description
PLUGIN_PROXY_URL May be used to specify a proxy (e.g. socks5://{ip_address}:{port})
PLUGIN_TIMEOUT Defines a timeout (in seconds) to stop the upload after a certain time.
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.

Development

There are only two tests right now and they are configured using Docker Compose. To run them, just use

make test

If someone wants to make this better (or add a Drone file) I'd gladly accept the patch.