├── Dockerfile ├── LICENSE ├── README.md ├── action.yml └── entrypoint.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.11 2 | 3 | COPY LICENSE README.md / 4 | 5 | RUN apk --no-cache add lftp 6 | 7 | COPY entrypoint.sh /entrypoint.sh 8 | 9 | ENTRYPOINT ["/entrypoint.sh"] 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Sebastian Popp and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ftp-action 2 | 3 | Automate copying your files via ftp using this GitHub action. 4 | 5 | ## Example usage 6 | 7 | ``` 8 | name: Deploy via ftp 9 | on: push 10 | jobs: 11 | deploy: 12 | name: Deploy 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Upload ftp 17 | uses: sebastianpopp/ftp-action@releases/v2 18 | with: 19 | host: ${{ secrets.FTP_SERVER }} 20 | user: ${{ secrets.FTP_USERNAME }} 21 | password: ${{ secrets.FTP_PASSWORD }} 22 | localDir: "dist" 23 | remoteDir: "www" 24 | options: "--delete --asci" 25 | ``` 26 | 27 | ## Input parameters 28 | 29 | Input parameter | Description | Required | Default 30 | --- | --- | --- | --- 31 | host | FTP server name | Yes | N/A 32 | user | FTP username | Yes | N/A 33 | password | FTP password | Yes | N/A 34 | localDir | The local directory to copy | No | . 35 | remoteDir | The remote directory to copy to | No | . 36 | forceSsl | Force SSL encryption | No | false 37 | options | Mirror command options | No | '' 38 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'ftp-action' 2 | author: 'Sebastian Popp ' 3 | description: 'Automate copying your files via FTP using this GitHub action.' 4 | inputs: 5 | host: 6 | description: 'FTP host' 7 | required: true 8 | user: 9 | description: 'FTP user' 10 | required: true 11 | password: 12 | description: 'FTP password' 13 | required: true 14 | forceSsl: 15 | description: 'Force SSL encryption' 16 | required: false 17 | default: 'false' 18 | localDir: 19 | description: 'Local directory' 20 | required: false 21 | default: '.' 22 | remoteDir: 23 | description: 'Remote directory' 24 | required: false 25 | default: '.' 26 | options: 27 | description: 'Additional mirror command options' 28 | required: false 29 | default: '' 30 | runs: 31 | using: 'docker' 32 | image: 'Dockerfile' 33 | branding: 34 | color: 'blue' 35 | icon: 'upload-cloud' 36 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -l 2 | 3 | lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ftp:ssl-force $INPUT_FORCESSL; set ssl:verify-certificate false; mirror $INPUT_OPTIONS --reverse --continue --dereference -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" 4 | --------------------------------------------------------------------------------