From 12afc5571707b75ce12ec686839e59a418a73b1a Mon Sep 17 00:00:00 2001 From: Thijs Niks Date: Thu, 14 Nov 2019 16:21:14 -0800 Subject: [PATCH 01/13] Excluding Git history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comparing all Git files on every action takes up time and I’m assuming people don’t need the Git history to be available on their FTP server --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index f1b60df..da1e7c8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,4 +2,4 @@ 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 ssl:verify-certificate false; mirror -R -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" From e46bbab164114d33a63ff65575348555877410aa Mon Sep 17 00:00:00 2001 From: Thijs Niks Date: Thu, 14 Nov 2019 20:49:02 -0800 Subject: [PATCH 02/13] Made the server variable a secret --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d7082a..8c9893f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ jobs: - name: Deploy FTP uses: sebastianpopp/ftp-action@master with: - host: "ftp.example.com" + host: ${{ secrets.FTP_SERVER }} user: ${{ secrets.FTP_USERNAME }} password: ${{ secrets.FTP_PASSWORD }} localDir: "dist" From 0dcdfc242f3bae5870c85d6a1900cc61d4eed81a Mon Sep 17 00:00:00 2001 From: Thijs Niks Date: Thu, 14 Nov 2019 20:52:08 -0800 Subject: [PATCH 03/13] Continue when possible --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index da1e7c8..747d03d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,4 +2,4 @@ set -e -lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror -R -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" +lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror -R -c -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" From 890fde3763772029ac24c5bba11f62db73be83ef Mon Sep 17 00:00:00 2001 From: Thijs Niks Date: Thu, 14 Nov 2019 20:52:48 -0800 Subject: [PATCH 04/13] Deference symbolic links --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 747d03d..2924dff 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,4 +2,4 @@ set -e -lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror -R -c -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" +lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror -R -c -L -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" From 49423c546342486d9c6d77d10a33fdece3e6e9bc Mon Sep 17 00:00:00 2001 From: Thijs Niks Date: Thu, 14 Nov 2019 20:54:10 -0800 Subject: [PATCH 05/13] Verbose bash commands --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 2924dff..7c1b429 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,4 +2,4 @@ set -e -lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror -R -c -L -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" +lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror --reverse --continue --dereference -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" From 098896f8aefc816428a266aedef64adff8579c71 Mon Sep 17 00:00:00 2001 From: Thijs Niks Date: Thu, 14 Nov 2019 21:05:33 -0800 Subject: [PATCH 06/13] Added bash feedback --- entrypoint.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7c1b429..7993fc6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,13 @@ #!/bin/sh -set -e +set -eu + +echo "Starting FTP Deploy" + +echo "Using $INPUT_USER to connect to $INPUT_HOST" + +echo "Mirroring from $INPUT_LOCALDIR to $INPUT_REMOTEDIR" lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror --reverse --continue --dereference -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" + +echo "FTP Deploy Complete" \ No newline at end of file From 5b5c1425a21a17370d6cbcb947c2736b4f911cf9 Mon Sep 17 00:00:00 2001 From: Thijs Niks Date: Fri, 15 Nov 2019 17:48:52 -0800 Subject: [PATCH 07/13] Revert "Added bash feedback" This reverts commit 098896f8aefc816428a266aedef64adff8579c71. --- entrypoint.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 7993fc6..7c1b429 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,13 +1,5 @@ #!/bin/sh -set -eu - -echo "Starting FTP Deploy" - -echo "Using $INPUT_USER to connect to $INPUT_HOST" - -echo "Mirroring from $INPUT_LOCALDIR to $INPUT_REMOTEDIR" +set -e lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror --reverse --continue --dereference -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" - -echo "FTP Deploy Complete" \ No newline at end of file From 60e94deadd99df7b2cabda98b190e03639e0aa99 Mon Sep 17 00:00:00 2001 From: Sebastian Popp Date: Sat, 16 Nov 2019 18:45:24 +0100 Subject: [PATCH 08/13] add new releases/v1 branch to readme --- Dockerfile | 6 ++---- README.md | 12 ++++++------ action.yml | 10 +++++----- entrypoint.sh | 4 +--- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 294f86c..83666f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,9 @@ FROM alpine:3.10 -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/README.md b/README.md index 8c9893f..2ac3687 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ # 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 + - name: Upload ftp + uses: sebastianpopp/ftp-action@releases/v1 with: host: ${{ secrets.FTP_SERVER }} user: ${{ secrets.FTP_USERNAME }} diff --git a/action.yml b/action.yml index 23b31df..903df30 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' @@ -19,9 +19,9 @@ inputs: description: 'Remote directory' required: false default: '.' -branding: - color: 'blue' - icon: 'upload' runs: using: 'docker' image: 'Dockerfile' +branding: + color: 'blue' + icon: 'upload-cloud' diff --git a/entrypoint.sh b/entrypoint.sh index 7c1b429..d134a62 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,3 @@ -#!/bin/sh - -set -e +#!/bin/sh -l lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror --reverse --continue --dereference -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" From acf64d3524abc7e358a26d029c764e71b820af9d Mon Sep 17 00:00:00 2001 From: ChrisDoernen Date: Thu, 5 Mar 2020 21:34:50 +0100 Subject: [PATCH 09/13] Add input parameter to enforce ssl encryption --- README.md | 2 ++ action.yml | 4 ++++ entrypoint.sh | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ac3687..a6e8991 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ jobs: host: ${{ secrets.FTP_SERVER }} user: ${{ secrets.FTP_USERNAME }} password: ${{ secrets.FTP_PASSWORD }} + forceSsl: true localDir: "dist" remoteDir: "www" ``` @@ -30,5 +31,6 @@ Input parameter | Description | Required | Default host | FTP server name | Yes | N/A user | FTP username | Yes | N/A password | FTP password | Yes | N/A +forceSsl | Force SSL encryption | No | false localDir | The local directory to copy | No | . remoteDir | The remote directory to copy to | No | . diff --git a/action.yml b/action.yml index 903df30..2f21399 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index d134a62..fabd34d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/sh -l -lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ssl:verify-certificate false; mirror --reverse --continue --dereference -x ^\.git/$ $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 --reverse --continue --dereference -x ^\.git/$ $INPUT_LOCALDIR $INPUT_REMOTEDIR; quit" From 169e275151698816e35a872c7a84a9f84355569d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20D=C3=B6rnen?= <32569989+ChrisDoernen@users.noreply.github.com> Date: Mon, 9 Mar 2020 20:07:47 +0100 Subject: [PATCH 10/13] Default values should be a string --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 2f21399..86ea246 100644 --- a/action.yml +++ b/action.yml @@ -14,7 +14,7 @@ inputs: forceSsl: description: 'Force SSL encryption' required: false - default: false + default: 'false' localDir: description: 'Local directory' required: false From 1204235acfa086acf73f3c9976a1407e3824d23e Mon Sep 17 00:00:00 2001 From: Sebastian Popp Date: Mon, 16 Mar 2020 10:01:41 +0100 Subject: [PATCH 11/13] use latest alpine image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 83666f5..145c391 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.10 +FROM alpine:3.11 COPY LICENSE README.md / From eb75c5cb29d23ee4a729720a27dfb66403cb0f6d Mon Sep 17 00:00:00 2001 From: Sebastian Popp Date: Mon, 16 Mar 2020 10:45:32 +0100 Subject: [PATCH 12/13] update readme and license --- LICENSE | 2 +- README.md | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) 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 a6e8991..22ae874 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,13 @@ jobs: name: Deploy runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Upload ftp - uses: sebastianpopp/ftp-action@releases/v1 + uses: sebastianpopp/ftp-action@releases/v2 with: host: ${{ secrets.FTP_SERVER }} user: ${{ secrets.FTP_USERNAME }} password: ${{ secrets.FTP_PASSWORD }} - forceSsl: true localDir: "dist" remoteDir: "www" ``` @@ -31,6 +30,6 @@ Input parameter | Description | Required | Default host | FTP server name | Yes | N/A user | FTP username | Yes | N/A password | FTP password | Yes | N/A -forceSsl | Force SSL encryption | No | false localDir | The local directory to copy | No | . remoteDir | The remote directory to copy to | No | . +forceSsl | Force SSL encryption | No | false From ca3f8d253d20ddd6aa658f8cb27fc847fd610882 Mon Sep 17 00:00:00 2001 From: hsimah Date: Sun, 31 Jan 2021 11:42:23 -0800 Subject: [PATCH 13/13] Feature/add additional opts (#17) * Update entrypoint.sh * Update action.yml * Update README.md * Update entrypoint.sh * pass through additional mirror options * restore meta-data --- README.md | 2 ++ action.yml | 4 ++++ entrypoint.sh | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 22ae874..50c4a78 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ jobs: password: ${{ secrets.FTP_PASSWORD }} localDir: "dist" remoteDir: "www" + options: "--delete --asci" ``` ## Input parameters @@ -33,3 +34,4 @@ 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 86ea246..6d362cb 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,10 @@ inputs: description: 'Remote directory' required: false default: '.' + options: + description: 'Additional mirror command options' + required: false + default: '' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index fabd34d..45331f7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/sh -l -lftp $INPUT_HOST -u $INPUT_USER,$INPUT_PASSWORD -e "set ftp:ssl-force $INPUT_FORCESSL; set ssl:verify-certificate false; mirror --reverse --continue --dereference -x ^\.git/$ $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"