https://github.com/cschlosser/drone-ftps
Deploy to FTPS server from Drone CI build
https://github.com/cschlosser/drone-ftps
drone drone-plugin ftps hacktoberfest
Last synced: 5 months ago
JSON representation
Deploy to FTPS server from Drone CI build
- Host: GitHub
- URL: https://github.com/cschlosser/drone-ftps
- Owner: cschlosser
- License: apache-2.0
- Created: 2017-10-25T08:55:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T00:42:23.000Z (over 3 years ago)
- Last Synced: 2025-12-22T07:53:42.604Z (6 months ago)
- Topics: drone, drone-plugin, ftps, hacktoberfest
- Language: Shell
- Homepage: https://hub.docker.com/r/cschlosser/drone-ftps/
- Size: 43.9 KB
- Stars: 20
- Watchers: 4
- Forks: 15
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deploy to FTP(S) server from Drone CI
[](https://hub.docker.com/r/cschlosser/drone-ftps/)
[](https://hub.docker.com/r/cschlosser/drone-ftps/)
[](https://hub.docker.com/r/cschlosser/drone-ftps/)
[](https://hub.docker.com/r/cschlosser/drone-ftps/)
## Usage
You have to set the username and password for your FTP server in the `FTP_USERNAME` and `FTP_PASSWORD` secret.
## Required settings
```yaml
environment:
FTP_USERNAME:
from_secret: username
FTP_PASSWORD:
from_secret: password
PLUGIN_HOSTNAME: example.com:21
```
## Optional settings
```yaml
environment:
PLUGIN_DEST_DIR: /path/to/dest (default /)
PLUGIN_SRC_DIR: /path/to/dest (default ./)
PLUGIN_SECURE: true | false (default true)
PLUGIN_VERIFY: false
PLUGIN_EXCLUDE: (egrep like pattern matching)
PLUGIN_INCLUDE: (egrep like pattern matching)
PLUGIN_CHMOD: true | false (default true)
PLUGIN_CLEAN_DIR: true | false (default false)
PLUGIN_ONLY_NEWER: true | false (default false)
PLUGIN_AUTO_CONFIRM: true | false (default false)
PLUGIN_SSH_ACCEPT_RSA: true | false (default false)
PLUGIN_PRE_ACTION: string (default empty)
PLUGIN_POST_ACTION: string (default empty)
PLUGIN_DEBUG: true | false (default false)
```
### Pre/Post Action
Pre/Post Action can be used to move files/folders out of the way or execute additional commands on the server before and after the deployment process.
The `PLUGIN_PRE_ACTION` is executed *before* the `PLUGIN_CLEAN_DIR` (if set).
The `PLUGIN_POST_ACTION` is executed *after* the ftp "mirror" operation.
Multiple Actions can be set, they need to be divided by a semicolon `;` .
#### Example:
There is another project's folder ("project2") in a subfolder in the destination directory. We need to move this folder to a temporary location and restore it after the upload completed.
```yaml
PLUGIN_CLEAN_DIR: true
PLUGIN_PRE_ACTION: mv /dest/project2 /temp/project2;
PLUGIN_POST_ACTION: mv /temp/project2 /dest/project2;
```
### Transfer only newer files
The setting `PLUGIN_ONLY_NEWER: true` (only transfer newer files) does not mix well with the `PLUGIN_CLEAN_DIR: true` (clean destination directory before transfer).
When setting `PLUGIN_ONLY_NEWER: true` parameter to true, make sure to _exclude_ any files/folders that are not present in the source directory, but should be kept on the server.
#### Example:
Source folder does not contain an `.env` file, it exists on the remote server and should be kept.
Also, we do not want to transfer the source's `.git` folder and `.gitignore` file:
Set `PLUGIN_ONLY_NEWER: true` and `PLUGIN_EXCLUDE: ^\.git/$,^\.gitignore$,^\.env$` environment variables.
## Full file example
```yaml
kind: pipeline
name: default
steps:
- name: master_build
image: cschlosser/drone-ftps
environment:
FTP_USERNAME:
from_secret: username
FTP_PASSWORD:
from_secret: password
PLUGIN_HOSTNAME: example.com:21
PLUGIN_SECURE: false
PLUGIN_VERIFY: false
PLUGIN_EXCLUDE: ^\.git/$
when:
branch:
- master
event:
- push
- name: develop_build
image: cschlosser/drone-ftps
environment:
FTP_USERNAME:
from_secret: username
FTP_PASSWORD:
from_secret: password
PLUGIN_HOSTNAME: example.com:21
PLUGIN_DEST_DIR: /develop
PLUGIN_SECURE: false
PLUGIN_VERIFY: false
PLUGIN_EXCLUDE: ^\.git/$
when:
branch:
- develop
event:
- push
```