8 Commits

Author SHA1 Message Date
Marco Dalla Santa
acf9c1fefc Merge pull request #18 from marcodallasanta/feature-use_sh_instead_of_bash
Fix #17
2022-03-22 21:46:48 +00:00
Marco Dalla Santa
23d4c34561 updates README and CHANGELOG 2022-03-22 21:44:25 +00:00
Marco Dalla Santa
ab06ee730f Fix #17 2022-03-22 21:38:49 +00:00
Marco Dalla Santa
fc430f0194 Changed from /bin/bash to /bin/sh which is busybox for alpine 2022-03-22 15:02:57 +00:00
Marco.DallaSanta
afa413dc37 fixed link to my github profile 2021-10-02 01:18:20 +02:00
Marco.DallaSanta
b7443178f2 Added ssh port option for pre-post scp. 2021-10-02 01:14:14 +02:00
Marco Dalla Santa
96257c43a1 Merge pull request #16 from jamesremuscat/main
resolves #15
2021-10-02 01:05:33 +02:00
James Muscat
9433396123 Honour INPUT_PORT in pre- and post-upload hooks. 2021-10-01 21:56:25 +01:00
6 changed files with 37 additions and 17 deletions

View File

@@ -1,6 +1,18 @@
# [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
# Added
- [Issue #15](https://github.com/marcodallasanta/ssh-scp-deploy/issues/15) - Added -p {INPUT_PORT} option.
## [v1.0.5] - 2021-09-08
### Fixed
- [Issue #12](https://github.com/marcodallasanta/ssh-scp-deploy/issues/12) - Action never failed also when file/dir was not uploaded.
## [v1.0.4] - 2021-02-10
@@ -30,6 +42,7 @@
[unreleased]: https://github.com/marcodallasanta/ssh-scp-deploy/compare/main...development
[v1.1.0]: https://github.com/underscore69/ssh-scp-deploy/tree/v1.1.0
[v1.0.5]: https://github.com/underscore69/ssh-scp-deploy/tree/v1.0.5
[v1.0.4]: https://github.com/underscore69/ssh-scp-deploy/tree/v1.0.4
[v1.0.3]: https://github.com/underscore69/ssh-scp-deploy/tree/v1.0.3

View File

@@ -3,8 +3,7 @@ FROM alpine:latest
RUN apk update && \
apk add --no-cache ca-certificates \
openssh-client \
sshpass \
bash
sshpass
COPY LICENSE README.md /
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}
with:
local: './' # Local file path - REQUIRED false - DEFAULT ./
remote: '~/' # Remote file path - REQUIRED false - DEFAULT ~/
host: ${{secrets.HOST}} # Remote server address - REQUIRED true
port: ${{secrets.PORT}} # Remote server port - REQUIRED false - DEFAULT 22
remote: '~/' # Remote file path - REQUIRED false - DEFAULT ~/
host: ${{secrets.HOST}} # Remote server address - REQUIRED true
port: ${{secrets.PORT}} # Remote server port - REQUIRED false - DEFAULT 22
user: ${{secrets.USER}} # Remote server user - REQUIRED true
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"
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
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"
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
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 ''
```
@@ -54,10 +54,14 @@ Feel free to check [issues page](https://github.com/mdallasanta/ssh-scp-deploy/i
## 🙏 Thanks
Thanks to [Raphaël Bussa](https://github.com/raphaelbussa) for help in testing.
Thanks to:
- [Raphaël Bussa](https://github.com/raphaelbussa) for help in testing.
- [jamesremuscat](https://github.com/jamesremuscat) for resolving [issue#15](https://github.com/marcodallasanta/ssh-scp-deploy/issues/15)
## 📝 License
Copyright © 2020 [Marco Dalla Santa](https://github.com/marcoallasanta)
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)

View File

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

View File

@@ -1,3 +1,5 @@
#!/bin/sh
echo "🔑 Adding ssh key..." &&
eval $(ssh-agent -s) &&
ssh-add <(echo "${INPUT_KEY}") &&
@@ -7,7 +9,7 @@ PRE_UPLOAD=${INPUT_PRE_UPLOAD}
if [ ! -z "$PRE_UPLOAD" ]; then
{
echo "👌 Executing pre-upload script..." &&
ssh ${INPUT_SSH_OPTIONS} ${INPUT_USER}@${INPUT_HOST} "$INPUT_PRE_UPLOAD && exit" &&
ssh ${INPUT_SSH_OPTIONS} -p "${INPUT_PORT}" ${INPUT_USER}@${INPUT_HOST} "$INPUT_PRE_UPLOAD && exit" &&
echo "✅ Executed pre-upload script"
} || {
echo "😢 Something went wrong during pre-upload script" && exit 1
@@ -26,7 +28,7 @@ POST_UPLOAD=${INPUT_POST_UPLOAD}
if [ ! -z "$POST_UPLOAD" ]; then
{
echo "👌 Executing post-upload script..." &&
ssh ${INPUT_SSH_OPTIONS} ${INPUT_USER}@${INPUT_HOST} "$POST_UPLOAD && exit" &&
ssh ${INPUT_SSH_OPTIONS} -p "${INPUT_PORT}" ${INPUT_USER}@${INPUT_HOST} "$POST_UPLOAD && exit" &&
echo "✅ Executed post-upload script"
} || {
echo "😢 Something went wrong during post-upload script" && exit 1

View File

@@ -1,8 +1,10 @@
#!/bin/sh
PRE_UPLOAD=${INPUT_PRE_UPLOAD}
if [ ! -z "$PRE_UPLOAD" ]; then
{
echo "👌 Executing pre-upload script..." &&
sshpass -p ${PASSWORD} ssh ${INPUT_SSH_OPTIONS} ${INPUT_USER}@${INPUT_HOST} "$INPUT_PRE_UPLOAD && exit" &&
sshpass -p ${PASSWORD} ssh ${INPUT_SSH_OPTIONS} -p "${INPUT_PORT}" ${INPUT_USER}@${INPUT_HOST} "$INPUT_PRE_UPLOAD && exit" &&
echo "✅ Executed pre-upload script"
} || {
echo "😢 Something went wrong during pre-upload script" && exit 1
@@ -14,14 +16,14 @@ fi
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 "😢 Something went wrong during upload" && exit 1 
echo "😢 Something went wrong during upload" && exit 1
}
POST_UPLOAD=${INPUT_POST_UPLOAD}
if [ ! -z "$POST_UPLOAD" ]; then
{
echo "👌 Executing post-upload script..." &&
sshpass -p ${PASSWORD} ssh ${INPUT_SSH_OPTIONS} ${INPUT_USER}@${INPUT_HOST} "$POST_UPLOAD && exit" &&
sshpass -p ${PASSWORD} ssh ${INPUT_SSH_OPTIONS} -p "${INPUT_PORT}" ${INPUT_USER}@${INPUT_HOST} "$POST_UPLOAD && exit" &&
echo "✅ Executed post-upload script"
} || {
echo "😢 Something went wrong during post-upload script" && exit 1