From fcca67b1fb54d4b1cde46e4f633e8701d8d882f7 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Sun, 31 Dec 2023 16:16:35 +0100 Subject: [PATCH] initial commit --- Containerfile | 9 +++++++++ action.yml | 22 ++++++++++++++++++++++ entrypoint.sh | 4 ++++ 3 files changed, 35 insertions(+) create mode 100644 Containerfile create mode 100644 action.yml create mode 100644 entrypoint.sh diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..8bea58b --- /dev/null +++ b/Containerfile @@ -0,0 +1,9 @@ +FROM docker.io/alpine:3.19 + +RUN apk --no-cache add \ + lftp \ + openssh-client + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..d8f6c38 --- /dev/null +++ b/action.yml @@ -0,0 +1,22 @@ +name: "Sftp Mirror" +description: "Mirror a folder to an sftp server." +inputs: + source: + description: "Source directory" + required: true + destination: + description: "Destination directory" + default: "/" + required: true + sftp-user: + description: "Sftp user name" + required: true + sftp-pw: + description: "Sftp password" + required: true + sftp-host: + description: "Sftp host" + required: true +runs: + using: "docker" + image: "Containerfile" diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..e4d239b --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +lftp -e "set sftp:auto-confirm yes; open -u $INPUT_SFTP_USER,$INPUT_SFTP_PW $SFTP_INPUT_HOST; mirror -v --no-perms --delete --reverse $INPUT_SOURCE $INPUT_DESTINATION; quit"