71 Commits
v1.0.0 ... main

Author SHA1 Message Date
Marco Dalla Santa
3898ca4aab Added contributing shoutout. 2022-05-04 22:21:38 +01:00
Marco Dalla Santa
9a8b4bdad5 Merge pull request #19 from x-limitless-x/patch-1
Spelling Error
2022-05-04 22:17:37 +01:00
Blake Drumm
a6d3c9af27 Spelling Error 2022-05-03 23:22:43 -04:00
Marco Dalla Santa
5557c731df fixed README links 2022-03-22 22:04:36 +00:00
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
Marco Dalla Santa
829467f2f1 Merge pull request #14 from marcodallasanta/development
Fix #12
2021-09-09 01:48:01 +02:00
Marco Dalla Santa
d4ff23a4b2 fix(CI): removed test statements 2021-09-09 01:44:42 +02:00
Marco Dalla Santa
1b7bbc195c fix(key): spacing 2021-09-09 01:43:30 +02:00
Marco Dalla Santa
c4514ca69d fix(key): fix spacing 2021-09-09 01:41:26 +02:00
Marco Dalla Santa
6df7204981 fix(key): typo 2021-09-09 01:39:10 +02:00
Marco Dalla Santa
0f1704d1ab fix(key): typo 2021-09-09 01:34:49 +02:00
Marco Dalla Santa
bfa5c669b4 test(CI): possible fix 2021-09-09 01:33:04 +02:00
Marco Dalla Santa
eee13f37dc fix(CI): removing test statement 2021-09-09 01:29:37 +02:00
Marco Dalla Santa
546131ac6d test(CI): this sshpass should fail 2021-09-09 01:28:25 +02:00
Marco Dalla Santa
cb11e978e7 fix(CI): missing spacing with pass 2021-09-09 01:23:51 +02:00
Marco Dalla Santa
988984a4c2 feat(CI): testing either KEY and PASS connection via ssh 2021-09-09 01:20:27 +02:00
Marco Dalla Santa
c842ff43ea fix(pass): grouped up commands in same shell 2021-09-09 01:12:09 +02:00
Marco Dalla Santa
3631d6aa3e doc(changelog): update changelog 2021-09-09 01:10:30 +02:00
Marco Dalla Santa
c04eabd1e8 fix(key): grouped up commands in same shell 2021-09-09 01:04:33 +02:00
Marco Dalla Santa
8f67304c1b test(CI): test workflow error 2021-09-09 00:37:02 +02:00
Marco Dalla Santa
11b60a4342 test(CI): test workflow error 2021-09-09 00:27:41 +02:00
Marco Dalla Santa
e700c123e8 test(CI): test workflow error 2021-09-09 00:26:51 +02:00
Marco Dalla Santa
f254055d37 fix(key|pass): executing log and exit in same shell but grouped up 2021-09-09 00:26:25 +02:00
Marco Dalla Santa
62e6e5e80a test(act): testing CI 2021-09-09 00:15:30 +02:00
Marco Dalla Santa
858fc481b1 test(act): act stopped working on branches? 2021-09-09 00:01:31 +02:00
Marco Dalla Santa
642835df3d fix(CI): spacing on yml 2021-09-08 23:55:57 +02:00
Marco Dalla Santa
8823857dea test(act): changed branch to pull with act 2021-09-08 23:51:22 +02:00
Marco Dalla Santa
00d3f20007 fix(key): changed error handling 2021-09-08 23:45:30 +02:00
Marco Dalla Santa
d2658b1812 fix(pwd): changed error handling 2021-09-08 23:41:27 +02:00
Marco Dalla Santa
49294a1b9a test(act): changed branch to pull with act 2021-09-08 23:26:46 +02:00
Marco Dalla Santa
601a3cdfc5 fix(pwd): added check for uploaded folder existence 2021-09-08 23:12:55 +02:00
Marco Dalla Santa
874eec1e4c Merge pull request #11 from marcodallasanta/development
Fix #9
2021-02-10 16:44:36 +01:00
Marco Dalla Santa
21d9038bb4 Update CHANGELOG 2021-02-10 16:43:47 +01:00
Marco Dalla Santa
8399b8ccf9 Fixes #9 2021-02-10 16:42:35 +01:00
Marco Dalla Santa
4856a9a4e9 Merge pull request #10 from marcodallasanta/development
Fixed hardcoded user in scp.
2021-02-08 17:50:34 +01:00
Marco Dalla Santa
7d22a8aeeb Fixed hardcoded user in scp. 2021-02-08 17:48:03 +01:00
Marco Dalla Santa
839788b727 Merge pull request #6 from marcodallasanta/development
Fixed entrypoint.sh
2020-12-21 22:54:59 +01:00
Marco Dalla Santa
5a27574133 Changed entry . 2020-12-21 22:48:14 +01:00
Marco Dalla Santa
5473b2d02c Changed CHANGELOG.md . 2020-12-21 22:27:03 +01:00
Marco Dalla Santa
7d6ed29410 Changed CHANGELOG.md . 2020-12-21 22:09:43 +01:00
Marco Dalla Santa
d744479d59 Changed entrypoiny.sh . 2020-12-21 22:06:57 +01:00
Marco Dalla Santa
b4eb8f8a33 Changed entrypoiny.sh . 2020-12-21 22:05:47 +01:00
Marco Dalla Santa
3393f06782 Changed main and entrypoint. 2020-12-21 22:00:05 +01:00
Marco Dalla Santa
0cdc30a56f Changed Dockerfile. 2020-12-21 21:53:04 +01:00
Marco Dalla Santa
e3f5136f75 Changed Dockerfile. 2020-12-21 21:44:32 +01:00
Marco Dalla Santa
5b2be75e1a Changed Dockerfile. 2020-12-21 21:39:35 +01:00
Marco Dalla Santa
0cb5842c53 Updated CHANGELOG. Changed Dockerfile. 2020-12-21 21:10:08 +01:00
Marco Dalla Santa
ad4bb0c9e0 Merge pull request #5 from marcodallasanta/development
Updated CHANGELOG. Improved Dockerfile to copy all .sh files.
2020-12-21 20:27:35 +01:00
Marco Dalla Santa
40de7fd0b7 Updated CHANGELOG. 2020-12-21 20:25:27 +01:00
Marco Dalla Santa
a9a68bc8ee Newline at end of Dockerfile. 2020-12-21 20:24:19 +01:00
Marco Dalla Santa
2d5fd18c0b Updated CHANGELOG. Fixed Dockerfile. 2020-12-21 20:23:16 +01:00
Marco Dalla Santa
1b7e36c773 Merge pull request #4 from marcodallasanta/development
Changed README. Fixed Dockerfile.
2020-12-21 20:18:32 +01:00
Marco Dalla Santa
f0079adc5b Changed README. Fixed Dockerfile. 2020-12-21 20:11:26 +01:00
Marco Dalla Santa
796ad8132d Merge pull request #3 from marcodallasanta/development
Refactored README and logo location.
2020-12-21 12:03:35 +01:00
Marco Dalla Santa
67587a1976 Changed README 2020-12-21 12:01:36 +01:00
Marco Dalla Santa
7635795846 Merge pull request #2 from mdallasanta/development
Added logo and badges.
2020-12-20 19:37:10 +01:00
Marco Dalla Santa
560f02a415 Changed README 2020-12-20 19:34:37 +01:00
Marco Dalla Santa
2ab605adf3 Changed README 2020-12-20 19:31:54 +01:00
Marco Dalla Santa
138c2fb2ea Added logo 2020-12-20 19:30:27 +01:00
Marco Dalla Santa
891f661b1b Added logo 2020-12-20 19:29:55 +01:00
Marco Dalla Santa
e5ccb99140 Merge pull request #1 from mdallasanta/development
Development
2020-12-20 19:01:48 +01:00
Marco Dalla Santa
2f78613c53 Changed README 2020-12-20 19:00:23 +01:00
Marco Dalla Santa
f705dfd43a Changed README 2020-12-20 18:57:10 +01:00
Marco Dalla Santa
c3ed5c67e7 Modified LICENSE. Enhanced README.md 2020-12-18 19:53:41 +01:00
9 changed files with 175 additions and 52 deletions

View File

@@ -6,18 +6,34 @@ on:
- main
jobs:
test:
test-key:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: underscore69/ssh-scp-deploy@main
- uses: marcodallasanta/ssh-scp-deploy@main
with:
local: "./"
local: "LICENSE"
remote: "~/"
host: ${{secrets.HOST}}
user: ${{secrets.USER}}
key: ${{secrets.KEY}}
pre_upload: echo "pre_upload 👈"
post_upload: echo "post_upload 👉"
test-pass:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: marcodallasanta/ssh-scp-deploy@development
with:
local: "CHANGELOG.md"
remote: "~/"
host: ${{secrets.HOST}}
user: ${{secrets.USER}}
password: ${{secrets.PASSWORD}}
pre_upload: echo "pre_upload 👈"
post_upload: echo "post_upload 👉"

View File

@@ -1,9 +1,51 @@
# [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
### Fixed
- [Issue #9](https://github.com/marcodallasanta/ssh-scp-deploy/issues/9) - Wrong if on password.
## [v1.0.3] - 2021-02-08
### Fixed
- Hardcoded user "ubuntu" in scp.
## [v1.0.2] - 2020-12-21
### Fixed
- Dockerfile used to copy just entrypoint.sh.
## [v1.0.1] - 2020-12-21
### Fixed
- Dockerfile used to copy just entrypoint.sh.
## [v1.0.0] - 2020-12-18
### Added
- First definition of the action.
[v1.0.0]: https://github.com/underscore69/ssh-scp-deploy/tree/v1.0.0
[unreleased]: https://github.com/marcodallasanta/ssh-scp-deploy/compare/main...development
[v1.1.0]: https://github.com/marcodallasanta/ssh-scp-deploy/tree/v1.1.0
[v1.0.5]: https://github.com/marcodallasanta/ssh-scp-deploy/tree/v1.0.5
[v1.0.4]: https://github.com/marcodallasanta/ssh-scp-deploy/tree/v1.0.4
[v1.0.3]: https://github.com/marcodallasanta/ssh-scp-deploy/tree/v1.0.3
[v1.0.2]: https://github.com/marcodallasanta/ssh-scp-deploy/tree/v1.0.2
[v1.0.1]: https://github.com/marcodallasanta/ssh-scp-deploy/tree/v1.0.1
[v1.0.0]: https://github.com/marcodallasanta/ssh-scp-deploy/tree/v1.0.0

View File

@@ -3,11 +3,9 @@ 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 /
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,7 +1,7 @@
The MIT License (MIT)
MIT License
Copyright (c) 2020 Marco Dalla Santa and contributors
Copyright (c) 2020 Marco Dalla Santa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,30 +1,67 @@
<p align="center">
<img src="resources/logo.png">
</p>
<p align="center">
<a href="https://docs.github.com/en/actions/creating-actions/about-actions#types-of-actions"><img alt="Action type" src="https://img.shields.io/badge/Docker%20action-262b31?logo=docker&logoColor=2496ed"></a>
<a href="LICENSE"><img alt="License" src="https://img.shields.io/github/license/marcodallasanta/ssh-scp-deploy"></a>
<a href="https://github.com/marcodallasanta/ssh-scp-deploy/actions?query=workflow%3ATest"><img alt="Pipeline status" src="https://github.com/marcodallasanta/ssh-scp-deploy/workflows/Test/badge.svg"></a>
</p>
# ssh-scp-deploy
[![Action type](https://img.shields.io/badge/Docker%20action-262b31?logo=docker&logoColor=2496ed)](https://docs.github.com/en/actions/creating-actions/about-actions#types-of-actions)
[![License](https://img.shields.io/github/license/underscore69/ssh-scp-deploy)](https://opensource.org/licenses/MIT)
[![Pipeline status](https://img.shields.io/github/workflow/status/underscore69/ssh-scp-deploy/Test?label=test)](./)
## ❔ Why should I use this action?
This action provide an easy and higly customizable way to upload files via scp and execute a set of command via ssh before or/and after.
Because this action provide an easy and highly customizable way to upload files via scp and execute a set of command via ssh before or/and after.
I use this action to deploy my personal projects to remote server, restarting the needed services or to do a simple upload via scp.
## Supported runners
## 🏃 Supported runners
[![Supported runner](https://img.shields.io/badge/Linux-262b31?style=for-the-badge&logo=linux&logoColor=fcc624)](https://docs.github.com/en/actions/creating-actions/about-actions#docker-container-actions)
## Usage
## 👤 Author
**Marco Dalla Santa**
* Twitter: [@marcodallasanta](https://twitter.com/marcodallasanta)
* Github: [@marcodallasanta](https://github.com/marcodallasanta)
* LinkedIn: [@marcodallasanta](https://linkedin.com/in/marcodallasanta)
## ⚙️ Usage
```yaml
- uses: underscore69/ssh-scp-deploy@v1.0.0
- 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 ''
```
## License
The source code, scripts and documentation in this project are released under the [MIT License](LICENSE)
## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/mdallasanta/ssh-scp-deploy/issues).
## 🙏 Thanks
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)
- [Blake Drumm](https://github.com/x-limitless-x) for resolving [issue#19](https://github.com/marcodallasanta/ssh-scp-deploy/issues/19)
## 📝 License
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,15 +1,17 @@
#!/bin/bash
PASSWORD=${INPUT_PASSWORD}
KEY=${INPUT_KEY}
if [ -z "$PRE_UPLOAD" and "$PASSWORD"]; then
#!/bin/sh
PASSWORD=${INPUT_PASSWORD};
KEY=${INPUT_KEY};
if [ -z "$KEY" ] && [ -z "$PASSWORD" ]; then
echo "🔑 Please provide at least a key or a password...";
exit 0;
fi
if [[ ! -z "$KEY" ]]; then
if [[ -n "$KEY" ]]; then
echo "🔑 Using key file...";
. with_key.sh;
source /with_key.sh;
else
echo "🔑 Using password...";
. with_pass.sh;
source /with_pass.sh;
fi

BIN
resources/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -1,3 +1,5 @@
#!/bin/sh
echo "🔑 Adding ssh key..." &&
eval $(ssh-agent -s) &&
ssh-add <(echo "${INPUT_KEY}") &&
@@ -5,20 +7,32 @@ echo "🔐 Added ssh key";
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" &&
echo "✅ Executed pre-upload script";
{
echo "👌 Executing pre-upload script..." &&
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
}
fi
echo "🚚 Uploading via scp..." &&
scp ${INPUT_SSH_OPTIONS} ${INPUT_SCP_OPTIONS} -P "${INPUT_PORT}" -r ${INPUT_LOCAL} ubuntu@${INPUT_HOST}:"${INPUT_REMOTE}" &&
echo "🙌 Uploaded via scp";
{
echo "🚚 Uploading via scp..." &&
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 
}
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" &&
echo "✅ Executed post-upload script";
{
echo "👌 Executing post-upload script..." &&
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
}
fi
echo "🎉 Done";

View File

@@ -1,19 +1,33 @@
#!/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" &&
echo "✅ Executed pre-upload script";
{
echo "👌 Executing pre-upload script..." &&
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
}
fi
echo "🚚 Uploading via scp..." &&
sshpass -p ${PASSWORD} scp ${INPUT_SSH_OPTIONS} ${INPUT_SCP_OPTIONS} -P "${INPUT_PORT}" -r ${INPUT_LOCAL} ubuntu@${INPUT_HOST}:"${INPUT_REMOTE}" &&
echo "🙌 Uploaded via scp";
{
echo "🚚 Uploading via scp..." &&
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
}
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" &&
echo "✅ Executed post-upload script";
{
echo "👌 Executing post-upload script..." &&
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
}
fi
echo "🎉 Done";