From 7b4ff3269bfd5cd3f84d2d1d01ff8f6ccdeef8ea Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 11 May 2019 17:01:31 +0800 Subject: [PATCH] feat: initial --- .github/main.workflow | 19 +++++++++++++++++ Dockerfile | 16 +++++++++++++++ README.md | 47 +++++++++++++++++++++++++++++++++++++++++-- entrypoint.sh | 7 +++++++ tests/a.txt | 1 + tests/b.txt | 1 + 6 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 .github/main.workflow create mode 100644 Dockerfile create mode 100755 entrypoint.sh create mode 100644 tests/a.txt create mode 100644 tests/b.txt diff --git a/.github/main.workflow b/.github/main.workflow new file mode 100644 index 0000000..10b12e4 --- /dev/null +++ b/.github/main.workflow @@ -0,0 +1,19 @@ +workflow "Send Notification" { + on = "push" + resolves = [ + "Copy multiple file", + ] +} + +action "Copy multiple file" { + uses = "appleboy/scp-action@master" + env = { + SOURCE = "tests/a.txt,tests/b.txt" + TARGET = "/home/actions/test" + } + secrets = [ + "HOST", + "USERNAME", + "PASSWORD", + ] +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7366711 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM appleboy/drone-scp + +# Github labels +LABEL "com.github.actions.name"="SCP" +LABEL "com.github.actions.description"="Copy files and artifacts via SSH" +LABEL "com.github.actions.icon"="copy" +LABEL "com.github.actions.color"="gray-dark" + +LABEL "repository"="https://github.com/appleboy/scp-action" +LABEL "homepage"="https://github.com/appleboy" +LABEL "maintainer"="Bo-Yi Wu " +LABEL "version"="0.0.1" + +ADD entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index a71d429..0b56830 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,45 @@ -# scp-action -GitHub Action that copy files and artifacts via SSH. +# 🚀 SCP for GitHub Actions + +[GitHub Action](https://developer.github.com/actions/) for copying files and artifacts via SSH. + + + +## Usage + +copy files and artifacts via SSH as blow. + +``` +action "Copy multiple file" { + uses = "appleboy/scp-action@master" + env = { + HOST = "example.com" + USERNAME = "foo" + PASSWORD = "bar" + PORT = "22" + SOURCE = "tests/a.txt,tests/b.txt" + TARGET = "/home/foo/test" + } + secrets = [ + "PASSWORD", + ] +} +``` + +### Example + +``` +action "Copy multiple file" { + uses = "appleboy/scp-action@master" + env = { + HOST = "example.com" + USERNAME = "foo" + PASSWORD = "bar" + PORT = "22" + SOURCE = "tests/a.txt,tests/b.txt" + TARGET = "/home/foo/test" + } + secrets = [ + "PASSWORD", + ] +} +``` diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..c729b71 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +export GITHUB="true" + +/bin/drone-scp diff --git a/tests/a.txt b/tests/a.txt new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/tests/a.txt @@ -0,0 +1 @@ +foo diff --git a/tests/b.txt b/tests/b.txt new file mode 100644 index 0000000..5716ca5 --- /dev/null +++ b/tests/b.txt @@ -0,0 +1 @@ +bar