diff --git a/Dockerfile b/Dockerfile index 294f86c..145c391 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,9 @@ -FROM alpine:3.10 +FROM alpine:3.11 -LABEL version="1.0.0" -LABEL repository="https://github.com/sebastianpopp/ftp-action" -LABEL homepage="https://github.com/sebastianpopp/ftp-action" -LABEL maintainer="Sebastian Popp " +COPY LICENSE README.md / RUN apk --no-cache add lftp COPY entrypoint.sh /entrypoint.sh + ENTRYPOINT ["/entrypoint.sh"] diff --git a/LICENSE b/LICENSE index a576e9d..c371d5f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Sebastian Popp +Copyright (c) 2020 Sebastian Popp and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 5d7082a..50c4a78 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,27 @@ # ftp-action -Automate copying your files via FTP using this GitHub action. +Automate copying your files via ftp using this GitHub action. ## Example usage ``` -name: Upload via FTP +name: Deploy via ftp on: push jobs: - FTP-Action: - name: FTP-Action + deploy: + name: Deploy runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Deploy FTP - uses: sebastianpopp/ftp-action@master + - uses: actions/checkout@v2 + - name: Upload ftp + uses: sebastianpopp/ftp-action@releases/v2 with: - host: "ftp.example.com" + host: ${{ secrets.FTP_SERVER }} user: ${{ secrets.FTP_USERNAME }} password: ${{ secrets.FTP_PASSWORD }} localDir: "dist" remoteDir: "www" + options: "--delete --asci" ``` ## Input parameters @@ -32,3 +33,5 @@ user | FTP username | Yes | N/A password | FTP password | Yes | N/A localDir | The local directory to copy | No | . remoteDir | The remote directory to copy to | No | . +forceSsl | Force SSL encryption | No | false +options | Mirror command options | No | '' diff --git a/action.yml b/action.yml index 23b31df..6d362cb 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ -name: 'FTP Action' -description: 'Mirrors a directory with a FTP server.' +name: 'ftp-action' author: 'Sebastian Popp ' +description: 'Automate copying your files via FTP using this GitHub action.' inputs: host: description: 'FTP host' @@ -11,6 +11,10 @@ inputs: password: description: 'FTP password' required: true + forceSsl: + description: 'Force SSL encryption' + required: false + default: 'false' localDir: description: 'Local directory' required: false @@ -19,9 +23,13 @@ inputs: description: 'Remote directory' required: false default: '.' -branding: - color: 'blue' - icon: 'upload' + options: + description: 'Additional mirror command options' + required: false + default: '' runs: using: 'docker' image: 'Dockerfile' +branding: + color: 'blue' + icon: 'upload-cloud' diff --git a/entrypoint.sh b/entrypoint.sh index f1b60df..45331f7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,3 @@ -#!/bin/sh +#!/bin/sh -l -set -e - -lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror -R $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" +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"