From 544c80dc4af2dfa0f3b31c2f4f95606341d3681a Mon Sep 17 00:00:00 2001 From: Dragan Filipovic Date: Wed, 25 Sep 2019 23:24:25 +0200 Subject: [PATCH] [init]: Add Source dir parameter --- Dockerfile | 15 +++++---------- README.md | 10 ++++++---- entrypoint.sh | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 93a81de..393fa20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,22 @@ FROM debian:9.5-slim - # Update RUN apt-get update - # Install packages RUN apt-get -yq install rsync openssh-client - # Label -LABEL "com.github.actions.name"="rsync deployments" -LABEL "com.github.actions.description"="For deploying code to a webserver via rsync over ssh" +LABEL "com.github.actions.name"="ssh deployments" +LABEL "com.github.actions.description"="For deploying code over ssh" LABEL "com.github.actions.icon"="truck" LABEL "com.github.actions.color"="yellow" -LABEL "repository"="http://github.com/contention/rsync-deployments" -LABEL "homepage"="https://github.com/contention/rsync-deployments" -LABEL "maintainer"="Contention " - +LABEL "repository"="http://github.com/easingthemes/ssh-deployments" +LABEL "homepage"="https://github.com/easingthemes/ssh-deployment" +LABEL "maintainer"="Dragan Filipovic " # Copy entrypoint ADD entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] - diff --git a/README.md b/README.md index aa9a04a..4dc73ff 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# rsync deployments +# ssh deployments -This GitHub Action deploys *everything* in `GITHUB_WORKSPACE` to a folder on a server via rsync over ssh. +This GitHub Action deploys specific directory from `GITHUB_WORKSPACE` to a folder on a server via rsync over ssh. -This action would usually follow a build/test action which leaves deployable code in `GITHUB_WORKSPACE`. +This action would usually follow a build/test action which leaves deployable code in `GITHUB_WORKSPACE`, eg `dist`; # Required SECRETs @@ -16,7 +16,9 @@ This action can receive three `ARG`s: 2. The second is for any `--exclude` flags and directory pairs, eg: `--exclude .htaccess --exclude /uploads/`. Use "" if none required. -3. The third is for the deployment target, and should be in the format: `[USER]@[HOST]:[PATH]` +3. The third is for the source target, path relative to `$GITHUB_WORKSPACE` root, eg: `dist` + +4. The fourth is for the deployment target, and should be in the format: `[USER]@[HOST]:[PATH]` # Example usage diff --git a/entrypoint.sh b/entrypoint.sh index 45fe097..0804556 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,4 +10,4 @@ chmod 600 "$SSH_PATH/deploy_key" # Do deployment -sh -c "rsync $1 -e 'ssh -i $SSH_PATH/deploy_key -o StrictHostKeyChecking=no' $2 $GITHUB_WORKSPACE/ $3" +sh -c "rsync $1 -e 'ssh -i $SSH_PATH/deploy_key -o StrictHostKeyChecking=no' $2 $GITHUB_WORKSPACE/$3 $4"