commit fcca67b1fb54d4b1cde46e4f633e8701d8d882f7 Author: Sebastian Hugentobler Date: Sun Dec 31 16:16:35 2023 +0100 initial commit 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"