Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
ErcinDedeoglu committed Jan 8, 2023
0 parents commit 965e58d
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) Ercin Dedeoglu <e.dedeoglu@gmail.com>. All rights reserved.
# https://github.com/ErcinDedeoglu/ftp-transfer-action
#
# Licensed under the MIT License.

FROM alpine:3.16

COPY LICENSE README.md /

RUN apk --no-cache add lftp

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Ercin Dedeoglu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# ftp-tranfer-action ✨

**Automate File Transfer via FTP using GitHub Actions**

- This GitHub Action allows you to automate the process of transferring
files via FTP. Simply specify the source and destination directories,
and the Action will handle the rest.

## Usage 💯
To use this Action, you'll need to add it to your workflow file. Here's an example of how to do so:

```
on: [push]
jobs:
transfer_files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Transfer files via FTP
uses: ercindedeoglu/ftp-transfer-action@v1
with:
source: '/path/to/local/source/directory'
destination: '/path/to/remote/destination/directory'
host: 'ftp.example.com'
user: 'your-ftp-username'
password: 'your-ftp-password'
options: "--delete --asci"
```

Replace the placeholders (e.g. your-username, /path/to/local/source/directory, etc.) with the appropriate values.


## Input parameters 🔤

Input parameter | Description | Required | Default
--- | --- | --- | ---
host | The hostname of the FTP server | Yes | N/A
user | The username to use when connecting to the FTP server | Yes | N/A
password | The password to use when connecting to the FTP server | Yes | N/A
source | The local directory from which files will be transferred | No | .
destination | The remote directory to which files will be transferred | No | .
forceSSL | Force SSL encryption | No | false
options | Mirror command options | No | ''


## IMPORTANT 🛎️

**Don't forget to use GitHub Secrets to store your FTP credentials.**
This will help ensure that your password is kept secure and is not exposed in your workflow file.

To use GitHub Secrets, you'll need to store your FTP credentials as secrets in your repository settings. Then, in your workflow file, you can reference those secrets using the ${{ secrets.SECRET_NAME }} syntax.

For example, to use the username and password secrets in the example above, you would modify the with block like so:

```
with:
source: '/path/to/local/source/directory'
destination: '/path/to/remote/destination/directory'
host: ftp.example.com
user: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
```

Remember to replace `USERNAME` and `PASSWORD` with the actual names you gave to your secrets.

## Contributing ❤️
**We welcome contributions to this project!**

If you have an idea for a new feature or have found a bug that needs to be fixed, please feel free to open an issue or submit a pull request.

Pull requests should be made to the main branch, and all code should be written in accordance with the project's style guidelines.

Before submitting a pull request, please ensure that you have run the test suite and received a passing result. This helps ensure that your changes do not break existing functionality.

**Thank you for considering contributing to this project!**


## Supporting this project 🎉

If you found this project helpful, please consider giving it a star on GitHub. Your support helps encourage future development and maintenance of this and other open source projects.

**Thank you for your support! 🫶**
36 changes: 36 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'ftp-transfer-action'
author: 'Ercin Dedeoglu <e.dedeoglu@gmail.com>'
description: 'This GitHub Action allows you to automate the process of transferring files via FTP.'
inputs:
host:
description: 'FTP host'
required: true
user:
description: 'FTP user'
required: true
password:
description: 'FTP password'
required: true
forceSsl:
description: 'Force SSL encryption'
required: false
default: 'false'
localDir:
description: 'Local directory'
required: false
default: '.'
remoteDir:
description: 'Remote directory'
required: false
default: '.'
options:
description: 'Additional mirror command options'
required: false
default: ''
runs:
using: 'docker'
image: 'Dockerfile'
branding:
color: 'red'
icon: 'upload-cloud'

8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh -l

# Copyright (c) Ercin Dedeoglu <e.dedeoglu@gmail.com>. All rights reserved.
# https://github.com/ErcinDedeoglu/ftp-transfer-action
#
# Licensed under the MIT License.

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"

0 comments on commit 965e58d

Please sign in to comment.