mirror of
https://github.com/appleboy/ssh-action.git
synced 2025-04-23 00:55:48 +00:00
Compare commits
No commits in common. "master" and "v1" have entirely different histories.
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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -43,7 +43,7 @@ jobs:
|
|||||||
whoami
|
whoami
|
||||||
|
|
||||||
- name: ssh commands from a file
|
- name: ssh commands from a file
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -95,7 +95,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: ssh by private key
|
- name: ssh by private key
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -104,7 +104,7 @@ jobs:
|
|||||||
script: whoami
|
script: whoami
|
||||||
|
|
||||||
- name: wrong password but correct key
|
- name: wrong password but correct key
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -114,7 +114,7 @@ jobs:
|
|||||||
script: whoami
|
script: whoami
|
||||||
|
|
||||||
- name: correct password but wrong key
|
- name: correct password but wrong key
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -167,7 +167,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -179,7 +179,7 @@ jobs:
|
|||||||
ls -al
|
ls -al
|
||||||
|
|
||||||
- name: missing ssh key passphrase
|
- name: missing ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
@ -192,7 +192,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -269,7 +269,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
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
|
||||||
@ -322,7 +322,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: testing id_ed25519 key
|
- name: testing id_ed25519 key
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -375,7 +375,7 @@ jobs:
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: testing id_ed25519 key
|
- name: testing id_ed25519 key
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -386,7 +386,7 @@ jobs:
|
|||||||
ls -al
|
ls -al
|
||||||
|
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
env:
|
env:
|
||||||
FOO: "BAR"
|
FOO: "BAR"
|
||||||
with:
|
with:
|
||||||
@ -400,7 +400,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
env:
|
env:
|
||||||
FOO: "BAR"
|
FOO: "BAR"
|
||||||
BAR: "FOO"
|
BAR: "FOO"
|
||||||
@ -419,7 +419,7 @@ jobs:
|
|||||||
echo "port: $PORT"
|
echo "port: $PORT"
|
||||||
|
|
||||||
- name: custom envs format
|
- name: custom envs format
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
env:
|
env:
|
||||||
FOO: "BAR"
|
FOO: "BAR"
|
||||||
AAA: "BBB"
|
AAA: "BBB"
|
||||||
@ -437,7 +437,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
env:
|
env:
|
||||||
INPUT_FOO: "BAR"
|
INPUT_FOO: "BAR"
|
||||||
INPUT_AAA: "BBB"
|
INPUT_AAA: "BBB"
|
||||||
@ -454,7 +454,7 @@ jobs:
|
|||||||
echo "$GITHUB_REF"
|
echo "$GITHUB_REF"
|
||||||
|
|
||||||
- name: switch to root user
|
- name: switch to root user
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ env.REMOTE_HOST }}
|
host: ${{ env.REMOTE_HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
|
@ -24,5 +24,5 @@ changelog:
|
|||||||
order: 4
|
order: 4
|
||||||
- title: "Documentation updates"
|
- title: "Documentation updates"
|
||||||
regexp: ^.*?docs?(\(.+\))??!?:.+$
|
regexp: ^.*?docs?(\(.+\))??!?:.+$
|
||||||
order: 5
|
order: 4
|
||||||
- title: Others
|
- title: Others
|
||||||
|
26
README.md
26
README.md
@ -49,8 +49,6 @@ Refer to [action.yml](./action.yml) for more detailed information.
|
|||||||
| debug | Enable debug mode | false |
|
| debug | Enable debug mode | false |
|
||||||
| allenvs | Pass the environment variables with prefix value of `GITHUB_` and `INPUT_` to the script | false |
|
| allenvs | Pass the environment variables with prefix value of `GITHUB_` and `INPUT_` to the script | false |
|
||||||
| request_pty | Request a pseudo-terminal from the server | false |
|
| request_pty | Request a pseudo-terminal from the server | false |
|
||||||
| curl_insecure | Allow curl to connect to SSL sites without certificates | false |
|
|
||||||
| version | drone-ssh binary version. If not specified, the latest version will be used. | |
|
|
||||||
|
|
||||||
**Note:** Users can add `set -e` in their shell script to achieve similar functionality to the removed `script_stop` option.
|
**Note:** Users can add `set -e` in their shell script to achieve similar functionality to the removed `script_stop` option.
|
||||||
|
|
||||||
@ -67,7 +65,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -185,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -198,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -211,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -228,7 +226,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: file commands
|
- name: file commands
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -241,7 +239,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com,bar.com"
|
+ host: "foo.com,bar.com"
|
||||||
@ -259,7 +257,7 @@ The default value of `port` is `22`.
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com:1234,bar.com:5678"
|
+ host: "foo.com:1234,bar.com:5678"
|
||||||
@ -274,7 +272,7 @@ The default value of `port` is `22`.
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: multiple host
|
- name: multiple host
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: "foo.com,bar.com"
|
host: "foo.com,bar.com"
|
||||||
+ sync: true
|
+ sync: true
|
||||||
@ -290,7 +288,7 @@ The default value of `port` is `22`.
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: pass environment
|
- name: pass environment
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
+ env:
|
+ env:
|
||||||
+ FOO: "BAR"
|
+ FOO: "BAR"
|
||||||
+ BAR: "FOO"
|
+ BAR: "FOO"
|
||||||
@ -337,7 +335,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh proxy command
|
- name: ssh proxy command
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -360,7 +358,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -386,7 +384,7 @@ Now you can adjust you config:
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
|
@ -49,8 +49,6 @@
|
|||||||
| debug | 启用调试模式 | false |
|
| debug | 启用调试模式 | false |
|
||||||
| allenvs | 将带有 `GITHUB_` 和 `INPUT_` 前缀的环境变量传递给脚本 | false |
|
| allenvs | 将带有 `GITHUB_` 和 `INPUT_` 前缀的环境变量传递给脚本 | false |
|
||||||
| request_pty | 请求伪终端 | false |
|
| request_pty | 请求伪终端 | false |
|
||||||
| curl_insecure | 在 curl 中使用不安全的证书验证 | false |
|
|
||||||
| version | drone-ssh 版本号。若未指定,将使用最新版本。 | |
|
|
||||||
|
|
||||||
**注意:** 用户可以在他们的 shell 脚本中添加 `set -e` 以实现类似于已删除的 `script_stop` 选项的功能。
|
**注意:** 用户可以在他们的 shell 脚本中添加 `set -e` 以实现类似于已删除的 `script_stop` 选项的功能。
|
||||||
|
|
||||||
@ -67,7 +65,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -185,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -198,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -211,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -228,7 +226,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: file commands
|
- name: file commands
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -241,7 +239,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com,bar.com"
|
+ host: "foo.com,bar.com"
|
||||||
@ -259,7 +257,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com:1234,bar.com:5678"
|
+ host: "foo.com:1234,bar.com:5678"
|
||||||
@ -274,7 +272,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: "foo.com,bar.com"
|
host: "foo.com,bar.com"
|
||||||
+ sync: true
|
+ sync: true
|
||||||
@ -290,7 +288,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
+ env:
|
+ env:
|
||||||
+ FOO: "BAR"
|
+ FOO: "BAR"
|
||||||
+ BAR: "FOO"
|
+ BAR: "FOO"
|
||||||
@ -337,7 +335,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh proxy command
|
- name: ssh proxy command
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -358,7 +356,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -384,7 +382,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
|
@ -49,8 +49,6 @@
|
|||||||
| debug | 啟用調試模式 | false |
|
| debug | 啟用調試模式 | false |
|
||||||
| allenvs | 將帶有 `GITHUB_` 和 `INPUT_` 前綴的環境變數傳遞給腳本 | false |
|
| allenvs | 將帶有 `GITHUB_` 和 `INPUT_` 前綴的環境變數傳遞給腳本 | false |
|
||||||
| request_pty | 從伺服器請求偽終端 | false |
|
| request_pty | 從伺服器請求偽終端 | false |
|
||||||
| curl_insecure | 在 curl 命令中使用不安全的 SSL 證書驗證 | false |
|
|
||||||
| version | drone-ssh 版本號。若未指定,將使用最新版本。 | |
|
|
||||||
|
|
||||||
**注意:** 用戶可以在他們的 shell 腳本中添加 `set -e` 以實現類似於已刪除的 `script_stop` 選項的功能。
|
**注意:** 用戶可以在他們的 shell 腳本中添加 `set -e` 以實現類似於已刪除的 `script_stop` 選項的功能。
|
||||||
|
|
||||||
@ -67,7 +65,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: linuxserver.io
|
username: linuxserver.io
|
||||||
@ -183,7 +181,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -196,7 +194,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -209,7 +207,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -226,7 +224,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com"
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: file commands
|
- name: file commands
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -239,7 +237,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com,bar.com"
|
+ host: "foo.com,bar.com"
|
||||||
@ -255,7 +253,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
- host: "foo.com"
|
- host: "foo.com"
|
||||||
+ host: "foo.com:1234,bar.com:5678"
|
+ host: "foo.com:1234,bar.com:5678"
|
||||||
@ -270,7 +268,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: "foo.com,bar.com"
|
host: "foo.com,bar.com"
|
||||||
+ sync: true
|
+ sync: true
|
||||||
@ -286,7 +284,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
+ env:
|
+ env:
|
||||||
+ FOO: "BAR"
|
+ FOO: "BAR"
|
||||||
+ BAR: "FOO"
|
+ BAR: "FOO"
|
||||||
@ -333,7 +331,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh proxy command
|
- name: ssh proxy command
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -354,7 +352,7 @@ Host FooServer
|
|||||||
|
|
||||||
```diff
|
```diff
|
||||||
- name: ssh key passphrase
|
- name: ssh key passphrase
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
@ -380,7 +378,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
|
uses: appleboy/ssh-action@v1.2.2
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.HOST }}
|
host: ${{ secrets.HOST }}
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
|
@ -75,15 +75,9 @@ inputs:
|
|||||||
description: "When true, passes all GitHub Actions environment variables to the remote script."
|
description: "When true, passes all GitHub Actions environment variables to the remote script."
|
||||||
request_pty:
|
request_pty:
|
||||||
description: "Request a pseudo-terminal from the server (required for interactive commands or sudo)."
|
description: "Request a pseudo-terminal from the server (required for interactive commands or sudo)."
|
||||||
curl_insecure:
|
|
||||||
description: "When true, uses the --insecure option with curl for insecure downloads."
|
|
||||||
default: "false"
|
|
||||||
capture_stdout:
|
capture_stdout:
|
||||||
description: "When true, captures and returns standard output from the commands as action output."
|
description: "When true, captures and returns standard output from the commands as action output."
|
||||||
default: "false"
|
default: "false"
|
||||||
version:
|
|
||||||
description: |
|
|
||||||
The version of drone-ssh to use.
|
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
stdout:
|
stdout:
|
||||||
@ -137,8 +131,6 @@ runs:
|
|||||||
INPUT_PROXY_CIPHER: ${{ inputs.proxy_cipher }}
|
INPUT_PROXY_CIPHER: ${{ inputs.proxy_cipher }}
|
||||||
INPUT_SYNC: ${{ inputs.sync }}
|
INPUT_SYNC: ${{ inputs.sync }}
|
||||||
INPUT_CAPTURE_STDOUT: ${{ inputs.capture_stdout }}
|
INPUT_CAPTURE_STDOUT: ${{ inputs.capture_stdout }}
|
||||||
INPUT_CURL_INSECURE: ${{ inputs.curl_insecure }}
|
|
||||||
DRONE_SSH_VERSION: ${{ inputs.version }}
|
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: "terminal"
|
icon: "terminal"
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
export GITHUB="true"
|
export GITHUB="true"
|
||||||
|
|
||||||
@ -8,49 +10,68 @@ 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.1}"
|
DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.8.1}"
|
||||||
|
|
||||||
function log_error() {
|
|
||||||
echo "$1" >&2
|
|
||||||
exit "$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
function detect_client_info() {
|
function detect_client_info() {
|
||||||
CLIENT_PLATFORM="${SSH_CLIENT_OS:-$(uname -s | tr '[:upper:]' '[:lower:]')}"
|
if [ -n "${SSH_CLIENT_OS-}" ]; then
|
||||||
CLIENT_ARCH="${SSH_CLIENT_ARCH:-$(uname -m)}"
|
CLIENT_PLATFORM="${SSH_CLIENT_OS}"
|
||||||
|
else
|
||||||
|
local kernel
|
||||||
|
kernel="$(uname -s)"
|
||||||
|
case "${kernel}" in
|
||||||
|
Darwin)
|
||||||
|
CLIENT_PLATFORM="darwin"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
CLIENT_PLATFORM="linux"
|
||||||
|
;;
|
||||||
|
Windows)
|
||||||
|
CLIENT_PLATFORM="windows"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown, unsupported platform: ${kernel}." >&2
|
||||||
|
echo "Supported platforms: Linux, Darwin and Windows." >&2
|
||||||
|
echo "Bailing out." >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
case "${CLIENT_PLATFORM}" in
|
if [ -n "${SSH_CLIENT_ARCH-}" ]; then
|
||||||
darwin | linux | windows) ;;
|
CLIENT_ARCH="${SSH_CLIENT_ARCH}"
|
||||||
*) log_error "Unknown or unsupported platform: ${CLIENT_PLATFORM}. Supported platforms are Linux, Darwin, and Windows." 2 ;;
|
else
|
||||||
esac
|
local machine
|
||||||
|
machine="$(uname -m)"
|
||||||
case "${CLIENT_ARCH}" in
|
case "${machine}" in
|
||||||
x86_64* | i?86_64* | amd64*) CLIENT_ARCH="amd64" ;;
|
x86_64* | i?86_64* | amd64*)
|
||||||
aarch64* | arm64*) CLIENT_ARCH="arm64" ;;
|
CLIENT_ARCH="amd64"
|
||||||
*) log_error "Unknown or unsupported architecture: ${CLIENT_ARCH}. Supported architectures are x86_64, i686, and arm64." 3 ;;
|
;;
|
||||||
esac
|
aarch64* | arm64*)
|
||||||
|
CLIENT_ARCH="arm64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown, unsupported architecture (${machine})." >&2
|
||||||
|
echo "Supported architectures x86_64, i686, arm64." >&2
|
||||||
|
echo "Bailing out." >&2
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
detect_client_info
|
detect_client_info
|
||||||
DOWNLOAD_URL_PREFIX="${DRONE_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}"
|
DOWNLOAD_URL_PREFIX="${DRONE_SSH_RELEASE_URL}/v${DRONE_SSH_VERSION}"
|
||||||
CLIENT_BINARY="drone-ssh-${DRONE_SSH_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}"
|
CLIENT_BINARY="drone-ssh-${DRONE_SSH_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}"
|
||||||
TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
|
TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
|
||||||
echo "Downloading ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
|
echo "Will download ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
|
||||||
INSECURE_OPTION=""
|
curl -fsSL --retry 5 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o ${TARGET}
|
||||||
if [[ "${INPUT_CURL_INSECURE}" == 'true' ]]; then
|
chmod +x ${TARGET}
|
||||||
INSECURE_OPTION="--insecure"
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}"
|
echo "======= CLI Version ======="
|
||||||
chmod +x "${TARGET}"
|
sh -c "${TARGET} --version" # print version
|
||||||
|
echo "==========================="
|
||||||
echo "======= CLI Version Information ======="
|
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
|
||||||
"${TARGET}" --version
|
echo 'stdout<<EOF' >>$GITHUB_OUTPUT # use heredoc for multiline output
|
||||||
echo "======================================="
|
sh -c "${TARGET} $*" | tee -a $GITHUB_OUTPUT # run the command
|
||||||
if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then
|
echo 'EOF' >>$GITHUB_OUTPUT
|
||||||
{
|
|
||||||
echo 'stdout<<EOF'
|
|
||||||
"${TARGET}" "$@" | tee -a "${GITHUB_OUTPUT}"
|
|
||||||
echo 'EOF'
|
|
||||||
} >>"${GITHUB_OUTPUT}"
|
|
||||||
else
|
else
|
||||||
"${TARGET}" "$@"
|
sh -c "${TARGET} $*" # run the command
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user