-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 965e58d
Showing
5 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! 🫶** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |