Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
6f091cd9e3 | |||
aa1ecdd19a | |||
bffdd4e1f4 | |||
f4890bec77 | |||
9aaf218321 |
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -43,7 +43,9 @@ jobs:
|
|||||||
# key: ${{ secrets.KEY }}
|
# key: ${{ secrets.KEY }}
|
||||||
# port: ${{ secrets.PORT }}
|
# port: ${{ secrets.PORT }}
|
||||||
# script_stop: true
|
# script_stop: true
|
||||||
# script: "mkdir abc/def,ls -al"
|
# script: |
|
||||||
|
# mkdir abc/def
|
||||||
|
# ls -al
|
||||||
|
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
@ -56,5 +58,5 @@ jobs:
|
|||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
envs: FOO
|
envs: FOO
|
||||||
script: |
|
script: |
|
||||||
echo "I am $FOO"
|
echo "I am $FOO, thanks"
|
||||||
echo "I am $BAR"
|
echo "I am $BAR, thanks"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM appleboy/drone-ssh:1.5.2-linux-amd64
|
FROM appleboy/drone-ssh:1.5.3-linux-amd64
|
||||||
|
|
||||||
ADD entrypoint.sh /entrypoint.sh
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
45
README.md
45
README.md
@ -1,6 +1,6 @@
|
|||||||
# 🚀 SSH for GitHub Actions
|
# 🚀 SSH for GitHub Actions
|
||||||
|
|
||||||
[GitHub Action](https://developer.github.com/actions/) for executing remote ssh commands.
|
[GitHub Action](https://github.com/features/actions) for executing remote ssh commands.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -11,7 +11,15 @@
|
|||||||
Executing remote ssh commands.
|
Executing remote ssh commands.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: executing remote ssh commands using password
|
name: remote ssh command
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
@ -28,9 +36,9 @@ output:
|
|||||||
whoami
|
whoami
|
||||||
======END======
|
======END======
|
||||||
out: ***
|
out: ***
|
||||||
==========================================
|
==============================================
|
||||||
Successfully executed commands to all host.
|
✅ Successfully executed commands to all host.
|
||||||
==========================================
|
==============================================
|
||||||
```
|
```
|
||||||
|
|
||||||
## Input variables
|
## Input variables
|
||||||
@ -38,7 +46,7 @@ Successfully executed commands to all host.
|
|||||||
see the [action.yml](./action.yml) file for more detail imformation.
|
see the [action.yml](./action.yml) file for more detail imformation.
|
||||||
|
|
||||||
* host - scp remote host
|
* host - scp remote host
|
||||||
* port - scp remote port
|
* port - scp remote port, default is `22`
|
||||||
* username - scp username
|
* username - scp username
|
||||||
* password - scp password
|
* password - scp password
|
||||||
* timeout - timeout for ssh to remote host, default is `30s`
|
* timeout - timeout for ssh to remote host, default is `30s`
|
||||||
@ -98,6 +106,7 @@ Multiple Commands
|
|||||||
Multiple Hosts
|
Multiple Hosts
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
@ -113,6 +122,7 @@ Multiple Hosts
|
|||||||
Pass environment variable to shell script
|
Pass environment variable to shell script
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
+ env:
|
+ env:
|
||||||
+ FOO: "BAR"
|
+ FOO: "BAR"
|
||||||
@ -129,14 +139,29 @@ Pass environment variable to shell script
|
|||||||
|
|
||||||
Stop script after first failure. ex: missing `abc` folder
|
Stop script after first failure. ex: missing `abc` folder
|
||||||
|
|
||||||
```yaml
|
```diff
|
||||||
- name: stop script if command error
|
- name: stop script if command error
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
key: ${{ secrets.KEY }}
|
key: ${{ secrets.KEY }}
|
||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
script_stop: true
|
+ script_stop: true
|
||||||
script: "mkdir abc/def,ls -al"
|
script: |
|
||||||
|
mkdir abc/def
|
||||||
|
ls -al
|
||||||
|
```
|
||||||
|
|
||||||
|
output:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
======CMD======
|
||||||
|
mkdir abc/def
|
||||||
|
ls -al
|
||||||
|
|
||||||
|
======END======
|
||||||
|
2019/11/21 01:16:21 Process exited with status 1
|
||||||
|
err: mkdir: cannot create directory ‘abc/def’: No such file or directory
|
||||||
|
##[error]Docker run failed with exit code 1
|
||||||
```
|
```
|
||||||
|
@ -6,6 +6,7 @@ inputs:
|
|||||||
description: 'ssh remote host'
|
description: 'ssh remote host'
|
||||||
port:
|
port:
|
||||||
description: 'ssh remote port'
|
description: 'ssh remote port'
|
||||||
|
default: 22
|
||||||
username:
|
username:
|
||||||
description: 'ssh username'
|
description: 'ssh username'
|
||||||
password:
|
password:
|
||||||
|
Reference in New Issue
Block a user