mirror of
https://github.com/appleboy/ssh-action.git
synced 2026-07-10 07:16:28 +00:00
Compare commits
No commits in common. "8fdfeb034ef6e9033a8a4407975aedbc12a08737" and "ab698e59d82afb1b65ffe8f70a0d482d744d6239" have entirely different histories.
8fdfeb034e
...
ab698e59d8
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
|
|||||||
9
.github/workflows/main.yml
vendored
9
.github/workflows/main.yml
vendored
@ -42,15 +42,6 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
whoami
|
whoami
|
||||||
|
|
||||||
- name: ssh commands from a file
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
host: ${{ env.REMOTE_HOST }}
|
|
||||||
username: linuxserver.io
|
|
||||||
password: password
|
|
||||||
port: 2222
|
|
||||||
script_path: testdata/test.sh
|
|
||||||
|
|
||||||
check-ssh-key:
|
check-ssh-key:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
32
.github/workflows/stable.yml
vendored
32
.github/workflows/stable.yml
vendored
@ -31,7 +31,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: ssh by username and password
|
- name: ssh by username and password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -86,7 +86,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: ssh by private key
|
- name: ssh by private key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -95,7 +95,7 @@ jobs:
|
|||||||
script: whoami
|
script: whoami
|
||||||
|
|
||||||
- name: wrong password but correct key
|
- name: wrong password but correct key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -105,7 +105,7 @@ jobs:
|
|||||||
script: whoami
|
script: whoami
|
||||||
|
|
||||||
- name: correct password but wrong key
|
- name: correct password but wrong key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -115,7 +115,7 @@ jobs:
|
|||||||
script: whoami
|
script: whoami
|
||||||
|
|
||||||
- name: stop script if command error
|
- name: stop script if command error
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
@ -174,7 +174,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -186,7 +186,7 @@ jobs:
|
|||||||
ls -al
|
ls -al
|
||||||
|
|
||||||
- name: missing ssh key passphrase
|
- name: missing ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
@ -199,7 +199,7 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/appleboy/ssh-action/issues/75#issuecomment-668314271
|
# https://github.com/appleboy/ssh-action/issues/75#issuecomment-668314271
|
||||||
- name: Multiline SSH commands interpreted as single lines
|
- name: Multiline SSH commands interpreted as single lines
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -277,7 +277,7 @@ jobs:
|
|||||||
|
|
||||||
# https://github.com/appleboy/ssh-action/issues/85
|
# https://github.com/appleboy/ssh-action/issues/85
|
||||||
- name: Deployment to multiple hosts with different ports
|
- name: Deployment to multiple hosts with different ports
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: "${{ env.REMOTE_HOST_01 }}:2222,${{ env.REMOTE_HOST_02 }}:2222"
|
host: "${{ env.REMOTE_HOST_01 }}:2222,${{ env.REMOTE_HOST_02 }}:2222"
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -331,7 +331,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: testing id_ed25519 key
|
- name: testing id_ed25519 key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -384,7 +384,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: testing id_ed25519 key
|
- name: testing id_ed25519 key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -395,7 +395,7 @@ jobs:
|
|||||||
ls -al
|
ls -al
|
||||||
|
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
env:
|
env:
|
||||||
FOO: "BAR"
|
FOO: "BAR"
|
||||||
with:
|
with:
|
||||||
@ -409,7 +409,7 @@ jobs:
|
|||||||
echo "I am $BAR, thanks"
|
echo "I am $BAR, thanks"
|
||||||
|
|
||||||
- name: pass multiple environment
|
- name: pass multiple environment
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
env:
|
env:
|
||||||
FOO: "BAR"
|
FOO: "BAR"
|
||||||
BAR: "FOO"
|
BAR: "FOO"
|
||||||
@ -428,7 +428,7 @@ jobs:
|
|||||||
echo "port: $PORT"
|
echo "port: $PORT"
|
||||||
|
|
||||||
- name: custom envs format
|
- name: custom envs format
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
env:
|
env:
|
||||||
FOO: "BAR"
|
FOO: "BAR"
|
||||||
AAA: "BBB"
|
AAA: "BBB"
|
||||||
@ -446,7 +446,7 @@ jobs:
|
|||||||
echo "I am $TEST_AAA, thanks"
|
echo "I am $TEST_AAA, thanks"
|
||||||
|
|
||||||
- name: pass all ENV variables to script
|
- name: pass all ENV variables to script
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
env:
|
env:
|
||||||
INPUT_FOO: "BAR"
|
INPUT_FOO: "BAR"
|
||||||
INPUT_AAA: "BBB"
|
INPUT_AAA: "BBB"
|
||||||
@ -463,7 +463,7 @@ jobs:
|
|||||||
echo "$GITHUB_REF"
|
echo "$GITHUB_REF"
|
||||||
|
|
||||||
- name: switch to root user
|
- name: switch to root user
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
|
|||||||
42
README.md
42
README.md
@ -46,7 +46,6 @@ See [action.yml](./action.yml) for more detailed information.
|
|||||||
| proxy_cipher | Allowed cipher algorithms for the proxy | |
|
| proxy_cipher | Allowed cipher algorithms for the proxy | |
|
||||||
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false |
|
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false |
|
||||||
| script | Execute commands | |
|
| script | Execute commands | |
|
||||||
| script_file | Execute commands from a file | |
|
|
||||||
| script_stop | Stop script after first failure | false |
|
| script_stop | Stop script after first failure | false |
|
||||||
| envs | Pass environment variables to shell script | |
|
| envs | Pass environment variables to shell script | |
|
||||||
| envs_format | Flexible configuration of environment value transfer | |
|
| envs_format | Flexible configuration of environment value transfer | |
|
||||||
@ -68,10 +67,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: linuxserver.io
|
username: ${{ secrets.USERNAME }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
port: ${{ secrets.PORT }}
|
port: ${{ secrets.PORT }}
|
||||||
script: whoami
|
script: whoami
|
||||||
@ -83,7 +82,7 @@ output:
|
|||||||
======CMD======
|
======CMD======
|
||||||
whoami
|
whoami
|
||||||
======END======
|
======END======
|
||||||
linuxserver.io
|
out: ***
|
||||||
===============================================
|
===============================================
|
||||||
✅ Successfully executed commands to all hosts.
|
✅ Successfully executed commands to all hosts.
|
||||||
===============================================
|
===============================================
|
||||||
@ -184,7 +183,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -197,7 +196,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: executing remote ssh commands using ssh key
|
- name: executing remote ssh commands using ssh key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -210,7 +209,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: multiple command
|
- name: multiple command
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -223,24 +222,11 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### Commands from a file
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: file commands
|
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
key: ${{ secrets.KEY }}
|
|
||||||
port: ${{ secrets.PORT }}
|
|
||||||
script_path: scripts/script.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Multiple Hosts
|
#### Multiple Hosts
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com,bar.com"
|
+ host: "foo.com,bar.com"
|
||||||
@ -258,7 +244,7 @@ The default value of `port` is `22`.
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com:1234,bar.com:5678"
|
+ host: "foo.com:1234,bar.com:5678"
|
||||||
@ -273,7 +259,7 @@ The default value of `port` is `22`.
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: "foo.com,bar.com"
|
host: "foo.com,bar.com"
|
||||||
+ sync: true
|
+ sync: true
|
||||||
@ -289,7 +275,7 @@ The default value of `port` is `22`.
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
+ env:
|
+ env:
|
||||||
+ FOO: "BAR"
|
+ FOO: "BAR"
|
||||||
+ BAR: "FOO"
|
+ BAR: "FOO"
|
||||||
@ -314,7 +300,7 @@ _Inside `env` object, you need to pass every environment variable as a string, p
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: stop script if command error
|
- name: stop script if command error
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -367,7 +353,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh proxy command
|
- name: ssh proxy command
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -390,7 +376,7 @@ It is not uncommon for files to leak from backups or decommissioned hardware, an
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -416,7 +402,7 @@ Now you can adjust you config:
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
* `key_path` - SSH 私钥的路径
|
* `key_path` - SSH 私钥的路径
|
||||||
* `fingerprint` - 主机公钥的 SHA256 指纹,默认为跳过验证
|
* `fingerprint` - 主机公钥的 SHA256 指纹,默认为跳过验证
|
||||||
* `script` - 执行命令
|
* `script` - 执行命令
|
||||||
* `script_file` - 執行命令的文件
|
|
||||||
* `script_stop` - 当出现第一个错误时停止执行命令
|
* `script_stop` - 当出现第一个错误时停止执行命令
|
||||||
* `envs` - 传递环境变量到 shell script
|
* `envs` - 传递环境变量到 shell script
|
||||||
* `debug` - 启用调试模式
|
* `debug` - 启用调试模式
|
||||||
@ -59,7 +58,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -158,7 +157,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -171,7 +170,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: executing remote ssh commands using ssh key
|
- name: executing remote ssh commands using ssh key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -184,7 +183,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: multiple command
|
- name: multiple command
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -201,7 +200,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
- host: ”foo.com“
|
- host: ”foo.com“
|
||||||
+ host: ”foo.com,bar.com“
|
+ host: ”foo.com,bar.com“
|
||||||
@ -213,24 +212,11 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
|
|||||||
ls -al
|
ls -al
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Commands from a file
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: file commands
|
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
key: ${{ secrets.KEY }}
|
|
||||||
port: ${{ secrets.PORT }}
|
|
||||||
script_path: scripts/script.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 多个不同端口的主机
|
#### 多个不同端口的主机
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
- host: ”foo.com“
|
- host: ”foo.com“
|
||||||
+ host: ”foo.com:1234,bar.com:5678“
|
+ host: ”foo.com:1234,bar.com:5678“
|
||||||
@ -245,7 +231,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ”foo.com,bar.com“
|
host: ”foo.com,bar.com“
|
||||||
+ sync: true
|
+ sync: true
|
||||||
@ -261,7 +247,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
+ env:
|
+ env:
|
||||||
+ FOO: ”BAR“
|
+ FOO: ”BAR“
|
||||||
+ BAR: ”FOO“
|
+ BAR: ”FOO“
|
||||||
@ -286,7 +272,7 @@ _在 `env` 对象中,您需要将每个环境变量作为字符串传递,传
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: stop script if command error
|
- name: stop script if command error
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -339,7 +325,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh proxy command
|
- name: ssh proxy command
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -360,7 +346,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -386,7 +372,7 @@ ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ’
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
* `key_path` - SSH 私鑰的路徑
|
* `key_path` - SSH 私鑰的路徑
|
||||||
* `fingerprint` - 主機公鑰的 SHA256 指紋,預設為略過驗證
|
* `fingerprint` - 主機公鑰的 SHA256 指紋,預設為略過驗證
|
||||||
* `script` - 執行命令
|
* `script` - 執行命令
|
||||||
* `script_file` - 執行命令的文件
|
|
||||||
* `script_stop` - 當出現第一個錯誤時停止執行命令
|
* `script_stop` - 當出現第一個錯誤時停止執行命令
|
||||||
* `envs` - 傳遞環境變數到 shell script
|
* `envs` - 傳遞環境變數到 shell script
|
||||||
* `debug` - 啟用偵錯模式
|
* `debug` - 啟用偵錯模式
|
||||||
@ -59,7 +58,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -158,7 +157,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: executing remote ssh commands using password
|
- name: executing remote ssh commands using password
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -171,7 +170,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: executing remote ssh commands using ssh key
|
- name: executing remote ssh commands using ssh key
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -184,7 +183,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: multiple command
|
- name: multiple command
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -197,24 +196,11 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### Commands from a file
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: file commands
|
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
key: ${{ secrets.KEY }}
|
|
||||||
port: ${{ secrets.PORT }}
|
|
||||||
script_path: scripts/script.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 多台主機
|
#### 多台主機
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com,bar.com"
|
+ host: "foo.com,bar.com"
|
||||||
@ -230,7 +216,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com:1234,bar.com:5678"
|
+ host: "foo.com:1234,bar.com:5678"
|
||||||
@ -245,7 +231,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: "foo.com,bar.com"
|
host: "foo.com,bar.com"
|
||||||
+ sync: true
|
+ sync: true
|
||||||
@ -261,7 +247,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
+ env:
|
+ env:
|
||||||
+ FOO: "BAR"
|
+ FOO: "BAR"
|
||||||
+ BAR: "FOO"
|
+ BAR: "FOO"
|
||||||
@ -286,7 +272,7 @@ _在 `env` 對象中,您需要將每個環境變量作為字符串傳遞,傳
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: stop script if command error
|
- name: stop script if command error
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -339,7 +325,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh proxy command
|
- name: ssh proxy command
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -360,7 +346,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -386,7 +372,7 @@ ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ' '
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1.2.0
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
|
|||||||
@ -63,8 +63,6 @@ inputs:
|
|||||||
description: "Include more ciphers for the proxy by using insecure ciphers."
|
description: "Include more ciphers for the proxy by using insecure ciphers."
|
||||||
script:
|
script:
|
||||||
description: "Commands to be executed."
|
description: "Commands to be executed."
|
||||||
script_path:
|
|
||||||
description: "Path to the file containing commands to be executed."
|
|
||||||
script_stop:
|
script_stop:
|
||||||
description: "Stop the script after the first failure."
|
description: "Stop the script after the first failure."
|
||||||
envs:
|
envs:
|
||||||
@ -112,7 +110,6 @@ runs:
|
|||||||
INPUT_PROXY_TIMEOUT: ${{ inputs.proxy_timeout }}
|
INPUT_PROXY_TIMEOUT: ${{ inputs.proxy_timeout }}
|
||||||
INPUT_COMMAND_TIMEOUT: ${{ inputs.command_timeout }}
|
INPUT_COMMAND_TIMEOUT: ${{ inputs.command_timeout }}
|
||||||
INPUT_SCRIPT: ${{ inputs.script }}
|
INPUT_SCRIPT: ${{ inputs.script }}
|
||||||
INPUT_SCRIPT_FILE: ${{ inputs.script_path }}
|
|
||||||
INPUT_SCRIPT_STOP: ${{ inputs.script_stop }}
|
INPUT_SCRIPT_STOP: ${{ inputs.script_stop }}
|
||||||
INPUT_ENVS: ${{ inputs.envs }}
|
INPUT_ENVS: ${{ inputs.envs }}
|
||||||
INPUT_ENVS_FORMAT: ${{ inputs.envs_format }}
|
INPUT_ENVS_FORMAT: ${{ inputs.envs_format }}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export GITHUB="true"
|
|||||||
|
|
||||||
GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"
|
GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}"
|
||||||
DRONE_SSH_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}"
|
DRONE_SSH_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}"
|
||||||
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.8.0}"
|
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.7.7}"
|
||||||
|
|
||||||
function detect_client_info() {
|
function detect_client_info() {
|
||||||
if [ -n "${SSH_CLIENT_OS-}" ]; then
|
if [ -n "${SSH_CLIENT_OS-}" ]; then
|
||||||
@ -17,21 +17,20 @@ function detect_client_info() {
|
|||||||
local kernel
|
local kernel
|
||||||
kernel="$(uname -s)"
|
kernel="$(uname -s)"
|
||||||
case "${kernel}" in
|
case "${kernel}" in
|
||||||
Darwin)
|
Darwin)
|
||||||
CLIENT_PLATFORM="darwin"
|
CLIENT_PLATFORM="darwin"
|
||||||
;;
|
;;
|
||||||
Linux)
|
Linux)
|
||||||
CLIENT_PLATFORM="linux"
|
CLIENT_PLATFORM="linux"
|
||||||
;;
|
;;
|
||||||
Windows)
|
Windows)
|
||||||
CLIENT_PLATFORM="windows"
|
CLIENT_PLATFORM="windows"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown, unsupported platform: ${kernel}." >&2
|
echo "Unknown, unsupported platform: ${kernel}." >&2
|
||||||
echo "Supported platforms: Linux, Darwin and Windows." >&2
|
echo "Supported platforms: Linux, Darwin and Windows." >&2
|
||||||
echo "Bailing out." >&2
|
echo "Bailing out." >&2
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -41,18 +40,18 @@ function detect_client_info() {
|
|||||||
local machine
|
local machine
|
||||||
machine="$(uname -m)"
|
machine="$(uname -m)"
|
||||||
case "${machine}" in
|
case "${machine}" in
|
||||||
x86_64* | i?86_64* | amd64*)
|
x86_64*|i?86_64*|amd64*)
|
||||||
CLIENT_ARCH="amd64"
|
CLIENT_ARCH="amd64"
|
||||||
;;
|
;;
|
||||||
aarch64* | arm64*)
|
aarch64*|arm64*)
|
||||||
CLIENT_ARCH="arm64"
|
CLIENT_ARCH="arm64"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown, unsupported architecture (${machine})." >&2
|
echo "Unknown, unsupported architecture (${machine})." >&2
|
||||||
echo "Supported architectures x86_64, i686, arm64." >&2
|
echo "Supported architectures x86_64, i686, arm64." >&2
|
||||||
echo "Bailing out." >&2
|
echo "Bailing out." >&2
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
3
testdata/test.sh
vendored
3
testdata/test.sh
vendored
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
whoami
|
|
||||||
Loading…
Reference in New Issue
Block a user