Merge pull request #18 from marcodallasanta/feature-use_sh_instead_of_bash

Fix #17
This commit is contained in:
Marco Dalla Santa
2022-03-22 21:46:48 +00:00
committed by GitHub
6 changed files with 20 additions and 12 deletions

View File

@@ -1,5 +1,10 @@
# [Unreleased] # [Unreleased]
## [v1.2.0] - 2021-03-22
# Added
- [Issue #17](https://github.com/marcodallasanta/ssh-scp-deploy/issues/15) - Using /bin/sh instead of /bin/bash.
## [v1.1.0] - 2021-10-02 ## [v1.1.0] - 2021-10-02
# Added # Added

View File

@@ -3,8 +3,7 @@ FROM alpine:latest
RUN apk update && \ RUN apk update && \
apk add --no-cache ca-certificates \ apk add --no-cache ca-certificates \
openssh-client \ openssh-client \
sshpass \ sshpass
bash
COPY LICENSE README.md / COPY LICENSE README.md /
COPY entrypoint.sh with_key.sh with_pass.sh / COPY entrypoint.sh with_key.sh with_pass.sh /

View File

@@ -34,14 +34,14 @@ I use this action to deploy my personal projects to remote server, restarting th
- uses: mdallasanta/ssh-scp-deploy@{version} - uses: mdallasanta/ssh-scp-deploy@{version}
with: with:
local: './' # Local file path - REQUIRED false - DEFAULT ./ local: './' # Local file path - REQUIRED false - DEFAULT ./
remote: '~/' # Remote file path - REQUIRED false - DEFAULT ~/ remote: '~/' # Remote file path - REQUIRED false - DEFAULT ~/
host: ${{secrets.HOST}} # Remote server address - REQUIRED true host: ${{secrets.HOST}} # Remote server address - REQUIRED true
port: ${{secrets.PORT}} # Remote server port - REQUIRED false - DEFAULT 22 port: ${{secrets.PORT}} # Remote server port - REQUIRED false - DEFAULT 22
user: ${{secrets.USER}} # Remote server user - REQUIRED true user: ${{secrets.USER}} # Remote server user - REQUIRED true
password: ${{secrets.PASSWORD}} # User password - REQUIRED at least one of "password" or "key" password: ${{secrets.PASSWORD}} # User password - REQUIRED at least one of "password" or "key"
key: ${{secrets.KEY}} # Remote server private key - REQUIRED at least one of "password" or "key" key: ${{secrets.KEY}} # Remote server private key - REQUIRED at least one of "password" or "key"
pre_upload: echo "This will be executed before the upload!" # Command to run via ssh before scp upload - REQUIRED false pre_upload: echo "This will be executed before the upload!" # Command to run via ssh before scp upload - REQUIRED false
post_upload: echo "This will be executed after the upload!" # Command to run via ssh after scp upload - REQUIRED false post_upload: echo "This will be executed after the upload!" # Command to run via ssh after scp upload - REQUIRED false
ssh_options: -o StrictHostKeyChecking=no # A set of ssh_option separated by -o - REQUIRED false - DEFAULT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ssh_options: -o StrictHostKeyChecking=no # A set of ssh_option separated by -o - REQUIRED false - DEFAULT -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
scp_options: -v # Flags to use during scp - REQUIRED false - DEFAULT '' scp_options: -v # Flags to use during scp - REQUIRED false - DEFAULT ''
``` ```
@@ -62,6 +62,6 @@ Thanks to:
## 📝 License ## 📝 License
Copyright © 2020-2021 [Marco Dalla Santa](https://github.com/marcodallasanta) Copyright © 2020-2022 [Marco Dalla Santa](https://github.com/marcodallasanta)
The source code, scripts and documentation in this project are released under the [MIT License](LICENSE) The source code, scripts and documentation in this project are released under the [MIT License](LICENSE)

View File

@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
PASSWORD=${INPUT_PASSWORD}; PASSWORD=${INPUT_PASSWORD};
KEY=${INPUT_KEY}; KEY=${INPUT_KEY};

View File

@@ -1,3 +1,5 @@
#!/bin/sh
echo "🔑 Adding ssh key..." && echo "🔑 Adding ssh key..." &&
eval $(ssh-agent -s) && eval $(ssh-agent -s) &&
ssh-add <(echo "${INPUT_KEY}") && ssh-add <(echo "${INPUT_KEY}") &&

View File

@@ -1,3 +1,5 @@
#!/bin/sh
PRE_UPLOAD=${INPUT_PRE_UPLOAD} PRE_UPLOAD=${INPUT_PRE_UPLOAD}
if [ ! -z "$PRE_UPLOAD" ]; then if [ ! -z "$PRE_UPLOAD" ]; then
{ {
@@ -14,7 +16,7 @@ fi
sshpass -p ${PASSWORD} scp ${INPUT_SSH_OPTIONS} ${INPUT_SCP_OPTIONS} -P "${INPUT_PORT}" -r ${INPUT_LOCAL} ${INPUT_USER}@${INPUT_HOST}:"${INPUT_REMOTE}" && sshpass -p ${PASSWORD} scp ${INPUT_SSH_OPTIONS} ${INPUT_SCP_OPTIONS} -P "${INPUT_PORT}" -r ${INPUT_LOCAL} ${INPUT_USER}@${INPUT_HOST}:"${INPUT_REMOTE}" &&
echo "🙌 Uploaded via scp" echo "🙌 Uploaded via scp"
} || { } || {
echo "😢 Something went wrong during upload" && exit 1  echo "😢 Something went wrong during upload" && exit 1
} }
POST_UPLOAD=${INPUT_POST_UPLOAD} POST_UPLOAD=${INPUT_POST_UPLOAD}