Compare commits

..

3 Commits

Author SHA1 Message Date
Bo-Yi Wu a1cdb5eb76 chore: add testing 2023-04-13 15:12:59 +08:00
Bo-Yi Wu 34bd117751 chore: add testing 2023-04-13 15:11:43 +08:00
Bo-Yi Wu 9ffd10117a chore: add testing 2023-04-13 14:52:27 +08:00
5 changed files with 282 additions and 335 deletions
+179 -232
View File
@@ -6,128 +6,129 @@ env:
BAR: "FOO" BAR: "FOO"
jobs: jobs:
testing01: testing01:
name: default flag testing name: default flag testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: correct password but wrong key - name: correct password but wrong key
uses: ./ uses: ./
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.PASSWORD }}
key: "1234" key: "1234"
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
script: whoami script: whoami
- name: wrong password but correct key - name: wrong password but correct key
uses: ./ uses: ./
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
password: "abcdef" password: "abcdef"
key: ${{ secrets.KEY }} key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
script: whoami script: whoami
- name: executing remote ssh commands using password - name: executing remote ssh commands using password
uses: ./ uses: ./
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
script: whoami script: whoami
- name: executing remote ssh commands using ssh key - name: executing remote ssh commands using ssh key
uses: ./ uses: ./
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: whoami script: whoami
- name: multiple command - name: multiple command
uses: ./ uses: ./
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: | script: |
whoami whoami
ls -al ls -al
- name: stop script if command error - name: stop script if command error
uses: ./ uses: ./
continue-on-error: true continue-on-error: true
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
sync: true sync: true
debug: true debug: true
script: | script: |
mkdir abc/def mkdir abc/def
ls -al ls -al
- name: ssh key passphrase - name: ssh key passphrase
uses: ./ uses: ./
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH2 }} key: ${{ secrets.SSH2 }}
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
passphrase: ${{ secrets.PASSPHRASE }} passphrase: ${{ secrets.PASSPHRASE }}
script: | script: |
whoami whoami
ls -al ls -al
- name: use insecure cipher - name: use insecure cipher
uses: ./ uses: ./
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
script: | script: |
ls \ ls \
-lah -lah
use_insecure_cipher: true use_insecure_cipher: true
# 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: ./ uses: ./
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
script_stop: true script_stop: true
script: | script: |
ls \ ls \
-lah -lah
use_insecure_cipher: true use_insecure_cipher: true
# 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: ./ uses: ./
with: with:
host: "${{ secrets.HOST }}:${{ secrets.PORT }}" host: "${{ secrets.HOST }}:${{ secrets.PORT }}"
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.PASSWORD }}
port: 1024 port: 1024
script_stop: true script_stop: true
script: | script: |
ls \ ls \
-lah -lah
use_insecure_cipher: true use_insecure_cipher: true
# - name: SSH ED25519 Private Key # - name: SSH ED25519 Private Key
# uses: ./ # uses: ./
@@ -142,143 +143,89 @@ jobs:
name: testing with envs name: testing with envs
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: pass environment - name: pass environment
uses: ./ uses: ./
env: env:
FOO: "BAR" FOO: "BAR"
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 }}
envs: FOO envs: FOO
script: | script: |
echo "I am $FOO, thanks" echo "I am $FOO, thanks"
echo "I am $BAR, thanks" echo "I am $BAR, thanks"
- name: pass multiple environment - name: pass multiple environment
uses: ./ uses: ./
env: env:
FOO: "BAR" FOO: "BAR"
BAR: "FOO" BAR: "FOO"
SHA: ${{ github.sha }} SHA: ${{ github.sha }}
PORT: ${{ secrets.PORT }} PORT: ${{ secrets.PORT }}
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 }}
envs: FOO,BAR,SHA,PORT envs: FOO,BAR,SHA,PORT
script: | script: |
echo "I am $FOO, thanks" echo "I am $FOO, thanks"
echo "I am $BAR, thanks" echo "I am $BAR, thanks"
echo "sha: $SHA" echo "sha: $SHA"
echo "port: $PORT" echo "port: $PORT"
sh test.sh sh test.sh
- name: custom envs format - name: custom envs format
uses: ./ uses: ./
env: env:
FOO: "BAR" FOO: "BAR"
AAA: "BBB" AAA: "BBB"
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 }}
envs: FOO,BAR,AAA envs: FOO,BAR,AAA
envs_format: export TEST_{NAME}={VALUE} envs_format: export TEST_{NAME}={VALUE}
script: | script: |
echo "I am $TEST_FOO, thanks" echo "I am $TEST_FOO, thanks"
echo "I am $TEST_BAR, thanks" echo "I am $TEST_BAR, thanks"
echo "I am $BAR, thanks" echo "I am $BAR, thanks"
echo "I am $TEST_AAA, thanks" echo "I am $TEST_AAA, thanks"
- name: pass all ENV variables to script
uses: ./
env:
INPUT_FOO: "BAR"
INPUT_AAA: "BBB"
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
allenvs: true
script: |
echo "I am $INPUT_FOO, thanks"
echo "I am $INPUT_AAA, thanks"
echo "$GITHUB_BASE_REF"
echo "$GITHUB_REF"
testing03: testing03:
name: git clone and pull name: git clone and pull
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: clone private repository - name: clone private repository
uses: ./ uses: ./
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: | script: |
git clone https://appleboy:${{ secrets.TEST_TOKEN }}@github.com/go-training/self-runner.git test_repository git clone https://appleboy:${{ secrets.TEST_TOKEN }}@github.com/go-training/self-runner.git test_repository
rm -rf test_repository rm -rf test_repository
testing04: - name: pull private repository
name: docker login and pull uses: ./
runs-on: ubuntu-latest with:
steps: host: ${{ secrets.HOST }}
- name: checkout username: ${{ secrets.USERNAME }}
uses: actions/checkout@v1 key: ${{ secrets.DEPLOY_SSH_KEY }}
port: ${{ secrets.PORT }}
- name: login GitHub Container Registry script_stop: true
uses: ./ script: |
with: git clone git@github.com:go-training/self-runner.git test_repository2
host: ${{ secrets.HOST }} cd test_repository2 && git pull
username: ${{ secrets.USERNAME }} rm -rf test_repository2
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script_stop: true
script: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u github.actor --password-stdin
- name: login DockerHub Container Registry
uses: ./
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script_stop: true
script: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
testing05:
name: switch user
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v1
- name: switch to root user
uses: ./
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script_stop: true
request_pty: true
command_timeout: 30s
script: |
whoami && echo 'hello world' && touch todo.txt
sudo whoami
+4 -4
View File
@@ -1,5 +1,5 @@
FROM ghcr.io/appleboy/drone-ssh:1.7.3 FROM ghcr.io/appleboy/drone-ssh:1.6.13
COPY entrypoint.sh /bin/entrypoint.sh COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/bin/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
+44 -45
View File
@@ -16,39 +16,38 @@ This thing is built using [Golang](https://go.dev) and [drone-ssh](https://githu
See [action.yml](./action.yml) for more detailed information. See [action.yml](./action.yml) for more detailed information.
| Input Parameter | Description | Default Value | * `host` - ssh host
|-------------------------|-----------------------------------------------------------------|---------------| * `port` - ssh port, default is `22`
| host | SSH host address | | * `username` - ssh username
| port | SSH port number | 22 | * `password` - ssh password
| passphrase | SSH key passphrase | | * `passphrase` - the passphrase is usually to encrypt the private key
| username | SSH username | | * `sync` - synchronous execution if multiple hosts, default is false
| password | SSH password | | * `timeout` - timeout for ssh to remote host, default is `30s`
| sync | Enable synchronous execution if multiple hosts | false | * `command_timeout` - timeout for ssh command, default is `10m`
| use_insecure_cipher | Include more ciphers with use_insecure_cipher | false | * `key` - content of ssh private key. ex raw content of ~/.ssh/id_rsa, remember include the BEGIN and END lines
| cipher | Allowed cipher algorithms. If unspecified, a sensible default | | * `key_path` - path of ssh private key
| timeout | Timeout duration for SSH to host | 30s | * `fingerprint` - fingerprint SHA256 of the host public key, default is to skip verification
| command_timeout | Timeout duration for SSH command | 10m | * `script` - execute commands
| key | Content of SSH private key. e.g., raw content of ~/.ssh/id_rsa | | * `script_stop` - stop script after first failure
| key_path | Path of SSH private key | | * `envs` - pass environment variable to shell script
| fingerprint | SHA256 fingerprint of the host public key | | * `debug` - enable debug mode
| proxy_host | SSH proxy host | | * `use_insecure_cipher` - include more ciphers with use_insecure_cipher (see [#56](https://github.com/appleboy/ssh-action/issues/56))
| proxy_port | SSH proxy port | 22 | * `cipher` - the allowed cipher algorithms. If unspecified then a sensible
| proxy_username | SSH proxy username | | * `envs_format` - flexible configuration of environment value transfer. default is `export {NAME}={VALUE}`
| proxy_password | SSH proxy password | |
| proxy_passphrase | SSH proxy key passphrase | | SSH Proxy Setting:
| proxy_timeout | Timeout for SSH to proxy host | 30s |
| proxy_key | Content of SSH proxy private key | | * `proxy_host` - proxy host
| proxy_key_path | Path of SSH proxy private key | | * `proxy_port` - proxy port, default is `22`
| proxy_fingerprint | SHA256 fingerprint of the proxy host public key | | * `proxy_username` - proxy username
| proxy_cipher | Allowed cipher algorithms for the proxy | | * `proxy_password` - proxy password
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false | * `proxy_passphrase` - the passphrase is usually to encrypt the private key
| script | Execute commands | | * `proxy_timeout` - timeout for ssh to proxy host, default is `30s`
| script_stop | Stop script after first failure | false | * `proxy_key` - content of ssh proxy private key.
| envs | Pass environment variables to shell script | | * `proxy_key_path` - path of ssh proxy private key
| envs_format | Flexible configuration of environment value transfer | | * `proxy_fingerprint` - fingerprint SHA256 of the proxy host public key, default is to skip verification
| debug | Enable debug mode | false | * `proxy_use_insecure_cipher` - include more ciphers with use_insecure_cipher (see [#56](https://github.com/appleboy/ssh-action/issues/56))
| allenvs | Pass all environment variables to shell script | false | * `proxy_cipher` - the allowed cipher algorithms. If unspecified then a sensible
| request_pty | Request a pseudo-terminal from the server | false |
## Usage ## Usage
@@ -64,7 +63,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -165,7 +164,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -178,7 +177,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -191,7 +190,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -208,7 +207,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
- host: "foo.com" - host: "foo.com"
+ host: "foo.com,bar.com" + host: "foo.com,bar.com"
@@ -224,7 +223,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
- host: "foo.com" - host: "foo.com"
+ host: "foo.com:1234,bar.com:5678" + host: "foo.com:1234,bar.com:5678"
@@ -239,7 +238,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: "foo.com,bar.com" host: "foo.com,bar.com"
+ sync: true + sync: true
@@ -255,7 +254,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.0.2 uses: appleboy/ssh-action@v0.1.10
+ env: + env:
+ FOO: "BAR" + FOO: "BAR"
+ BAR: "FOO" + BAR: "FOO"
@@ -280,7 +279,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -333,7 +332,7 @@ Host FooServer
```diff ```diff
- name: ssh proxy command - name: ssh proxy command
uses: appleboy/ssh-action@v1.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -356,7 +355,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -382,7 +381,7 @@ Now you can adjust you config:
```diff ```diff
- name: ssh key passphrase - name: ssh key passphrase
uses: appleboy/ssh-action@v1.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
+12 -12
View File
@@ -58,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -157,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -170,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -183,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -200,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
- host: "foo.com" - host: "foo.com"
+ host: "foo.com,bar.com" + host: "foo.com,bar.com"
@@ -216,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
- host: "foo.com" - host: "foo.com"
+ host: "foo.com:1234,bar.com:5678" + host: "foo.com:1234,bar.com:5678"
@@ -231,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: "foo.com,bar.com" host: "foo.com,bar.com"
+ sync: true + sync: true
@@ -247,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.0.2 uses: appleboy/ssh-action@v0.1.10
+ env: + env:
+ FOO: "BAR" + FOO: "BAR"
+ BAR: "FOO" + BAR: "FOO"
@@ -272,7 +272,7 @@ _在 `env` 對象中,您需要將每個環境變量作為字符串傳遞,傳
```diff ```diff
- name: stop script if command error - name: stop script if command error
uses: appleboy/ssh-action@v1.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -325,7 +325,7 @@ Host FooServer
```diff ```diff
- name: ssh proxy command - name: ssh proxy command
uses: appleboy/ssh-action@v1.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -346,7 +346,7 @@ Host FooServer
```diff ```diff
- name: ssh key passphrase - name: ssh key passphrase
uses: appleboy/ssh-action@v1.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
@@ -372,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.0.2 uses: appleboy/ssh-action@v0.1.10
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
+43 -42
View File
@@ -1,78 +1,79 @@
name: "SSH Remote Commands" name: 'SSH Remote Commands'
description: "Executing remote ssh commands" description: 'Executing remote ssh commands'
author: "Bo-Yi Wu" author: 'Bo-Yi Wu'
inputs: inputs:
host: host:
description: "SSH host address." description: 'ssh host'
port: port:
description: "SSH port number." description: 'ssh port'
default: "22" default: 22
passphrase: passphrase:
description: "Passphrase for the SSH key." description: 'ssh key passphrase'
username: username:
description: "SSH username." description: 'ssh username'
password: password:
description: "SSH password." description: 'ssh password'
sync: sync:
description: "Enable synchronous execution if multiple hosts are involved." description: 'synchronous execution if multiple hosts'
default: false
use_insecure_cipher: use_insecure_cipher:
description: "Include more ciphers by using insecure ciphers." description: 'include more ciphers with use_insecure_cipher'
default: false
cipher: cipher:
description: "Allowed cipher algorithms. If unspecified, a sensible default is used." description: 'the allowed cipher algorithms. If unspecified then a sensible'
timeout: timeout:
description: "Timeout duration for establishing SSH connection to the host." description: 'timeout for ssh to host'
default: "30s" default: "30s"
command_timeout: command_timeout:
description: "Timeout duration for SSH commands execution." description: 'timeout for ssh command'
default: "10m" default: "10m"
key: key:
description: "Content of the SSH private key. For example, the raw content of ~/.ssh/id_rsa." description: 'content of ssh private key. ex raw content of ~/.ssh/id_rsa'
key_path: key_path:
description: "Path to the SSH private key file." description: 'path of ssh private key'
fingerprint: fingerprint:
description: "SHA256 fingerprint of the host public key." description: 'sha256 fingerprint of the host public key'
proxy_host: proxy_host:
description: "SSH proxy host address." description: 'ssh proxy host'
proxy_port: proxy_port:
description: "SSH proxy port number." description: 'ssh proxy port'
default: "22" default: 22
proxy_username: proxy_username:
description: "SSH proxy username." description: 'ssh proxy username'
proxy_password: proxy_password:
description: "SSH proxy password." description: 'ssh proxy password'
proxy_passphrase: proxy_passphrase:
description: "SSH proxy key passphrase." description: 'ssh proxy key passphrase'
proxy_timeout: proxy_timeout:
description: "Timeout duration for establishing SSH connection to the proxy host." description: 'timeout for ssh to proxy host'
default: "30s" default: "30s"
proxy_key: proxy_key:
description: "Content of the SSH proxy private key. For example, the raw content of ~/.ssh/id_rsa." description: 'content of ssh proxy private key. ex raw content of ~/.ssh/id_rsa'
proxy_key_path: proxy_key_path:
description: "Path to the SSH proxy private key file." description: 'path of ssh proxy private key'
proxy_fingerprint: proxy_fingerprint:
description: "SHA256 fingerprint of the proxy host public key." description: 'sha256 fingerprint of the proxy host public key'
proxy_cipher: proxy_cipher:
description: "Allowed cipher algorithms for the proxy. If unspecified, a sensible default is used." description: 'the allowed cipher algorithms. If unspecified then a sensible'
proxy_use_insecure_cipher: proxy_use_insecure_cipher:
description: "Include more ciphers for the proxy by using insecure ciphers." description: 'include more ciphers with use_insecure_cipher'
default: false
script: script:
description: "Commands to be executed." description: 'execute commands'
script_stop: script_stop:
description: "Stop the script after the first failure." description: 'stop script after first failure'
default: false
envs: envs:
description: "Environment variables to be passed to the shell script." description: 'pass environment variable to shell script'
envs_format: envs_format:
description: "Flexible configuration for environment value transfer." description: 'flexible configuration of environment value transfer'
debug: debug:
description: "Enable debug mode." description: 'enable debug mode'
allenvs: default: false
description: "pass all environment variable to shell script."
request_pty:
description: "Request a pseudo-terminal from the server."
runs: runs:
using: "docker" using: 'docker'
image: "Dockerfile" image: 'Dockerfile'
branding: branding:
icon: "terminal" icon: 'terminal'
color: "gray-dark" color: 'gray-dark'