From 703ffa3c1ee959aa3694ac64b3a8a9bfa38c2c20 Mon Sep 17 00:00:00 2001 From: appleboy Date: Mon, 28 Oct 2024 22:36:36 +0800 Subject: [PATCH 01/12] feat(actions): enhance system performance and API integration - Add `proxy_protocol` input with description and default value "tcp" Signed-off-by: appleboy --- action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/action.yml b/action.yml index 4a16472..bf15e25 100644 --- a/action.yml +++ b/action.yml @@ -43,6 +43,9 @@ inputs: description: "SSH proxy username." proxy_password: description: "SSH proxy password." + proxy_protocol: + description: 'The IP protocol to use. Valid values are "tcp". "tcp4" or "tcp6". Default to tcp.' + default: "tcp" proxy_passphrase: description: "SSH proxy key passphrase." proxy_timeout: From ab698e59d82afb1b65ffe8f70a0d482d744d6239 Mon Sep 17 00:00:00 2001 From: appleboy Date: Mon, 28 Oct 2024 22:37:55 +0800 Subject: [PATCH 02/12] docs(readme): enhance network protocol support and testing - Add `proxy_protocol` option to the README with possible values `tcp`, `tcp4`, `tcp6` and default `tcp` Signed-off-by: appleboy --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 347f512..da31541 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ See [action.yml](./action.yml) for more detailed information. | fingerprint | SHA256 fingerprint of the host public key | | | proxy_host | SSH proxy host | | | proxy_port | SSH proxy port | 22 | +| proxy_protocol | SSH proxy protocol version (tcp, tcp4, tcp6) | tcp | | proxy_username | SSH proxy username | | | proxy_password | SSH proxy password | | | proxy_passphrase | SSH proxy key passphrase | | From 362a7f1677aa40aaec6bb1d6fd119b2e080fd7f3 Mon Sep 17 00:00:00 2001 From: Kyle Leonhard Date: Sat, 16 Nov 2024 22:57:46 -0800 Subject: [PATCH 03/12] chore: support running commands from a file (#341) --- .github/workflows/main.yml | 9 +++++++++ README.md | 14 ++++++++++++++ action.yml | 3 +++ testdata/test.sh | 3 +++ 4 files changed, 29 insertions(+) create mode 100644 testdata/test.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e248967..6c35463 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,6 +42,15 @@ jobs: set -e 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: runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index da31541..56c6cec 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ See [action.yml](./action.yml) for more detailed information. | proxy_cipher | Allowed cipher algorithms for the proxy | | | proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher for the proxy | false | | script | Execute commands | | +| script_file | Execute commands from a file | | | script_stop | Stop script after first failure | false | | envs | Pass environment variables to shell script | | | envs_format | Flexible configuration of environment value transfer | | @@ -222,6 +223,19 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ![result](./images/output-result.png) +#### Commands from a file + +```yaml +- name: file commands + uses: appleboy/ssh-action@v1.1.0 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + script_path: scripts/script.sh +``` + #### Multiple Hosts ```diff diff --git a/action.yml b/action.yml index bf15e25..19668ab 100644 --- a/action.yml +++ b/action.yml @@ -63,6 +63,8 @@ inputs: description: "Include more ciphers for the proxy by using insecure ciphers." script: description: "Commands to be executed." + script_path: + description: "Path to the file containing commands to be executed." script_stop: description: "Stop the script after the first failure." envs: @@ -110,6 +112,7 @@ runs: INPUT_PROXY_TIMEOUT: ${{ inputs.proxy_timeout }} INPUT_COMMAND_TIMEOUT: ${{ inputs.command_timeout }} INPUT_SCRIPT: ${{ inputs.script }} + INPUT_SCRIPT_FILE: ${{ inputs.script_path }} INPUT_SCRIPT_STOP: ${{ inputs.script_stop }} INPUT_ENVS: ${{ inputs.envs }} INPUT_ENVS_FORMAT: ${{ inputs.envs_format }} diff --git a/testdata/test.sh b/testdata/test.sh new file mode 100644 index 0000000..3574ebc --- /dev/null +++ b/testdata/test.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -e +whoami \ No newline at end of file From bf84378588277d5361a4cb8b7b3b42912fc3fcab Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 15:00:26 +0800 Subject: [PATCH 04/12] refactor: refactor codebase and improve API performance - Signed-off-by: appleboy --- testdata/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/test.sh b/testdata/test.sh index 3574ebc..a229cae 100644 --- a/testdata/test.sh +++ b/testdata/test.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash set -e -whoami \ No newline at end of file +whoami From 25259c3d5059bb20c4b45bf5089d58098b0a5b93 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 15:02:20 +0800 Subject: [PATCH 05/12] fix: refactor and enhance API and testing infrastructure - Update DRONE_SSH_VERSION from 1.7.7 to 1.8.0 - Add missing case statement terminator in detect_client_info function Signed-off-by: appleboy --- entrypoint.sh | 55 ++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 67132c6..abd5809 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,7 +8,7 @@ export GITHUB="true" GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}" DRONE_SSH_RELEASE_URL="${DRONE_SSH_RELEASE_URL:-https://github.com/appleboy/drone-ssh/releases/download}" -DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.7.7}" +DRONE_SSH_VERSION="${DRONE_SSH_VERSION:-1.8.0}" function detect_client_info() { if [ -n "${SSH_CLIENT_OS-}" ]; then @@ -17,20 +17,21 @@ function detect_client_info() { 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 + 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 @@ -40,18 +41,18 @@ function detect_client_info() { local machine machine="$(uname -m)" case "${machine}" in - x86_64*|i?86_64*|amd64*) - CLIENT_ARCH="amd64" - ;; - 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 - ;; + x86_64* | i?86_64* | amd64*) + CLIENT_ARCH="amd64" + ;; + 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 } From 176437b5488c703fa41f14a89a8458192086f8f3 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 15:05:56 +0800 Subject: [PATCH 06/12] chore: refactor codebase for improved consistency and performance - Change the username from `${{ secrets.USERNAME }}` to `linuxserver.io` - Update the output from `***` to `linuxserver.io` Signed-off-by: appleboy --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 56c6cec..71e8bb7 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ jobs: uses: appleboy/ssh-action@v1.1.0 with: host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} + username: linuxserver.io password: ${{ secrets.PASSWORD }} port: ${{ secrets.PORT }} script: whoami @@ -83,7 +83,7 @@ output: ======CMD====== whoami ======END====== -out: *** +linuxserver.io =============================================== ✅ Successfully executed commands to all hosts. =============================================== From 7eaf76671a0d7eec5d98ee897acda4f968735a17 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 15:08:23 +0800 Subject: [PATCH 07/12] docs(readme): update SSH action and enhance Chinese README files - Update `appleboy/ssh-action` from version `v1.1.0` to `v1.2.0` in multiple instances - Add `script_file` option to the Chinese (Simplified) and Chinese (Traditional) README files - Add example for executing commands from a file in the Chinese (Simplified) and Chinese (Traditional) README files Signed-off-by: appleboy --- README.md | 26 +++++++++++++------------- README.zh-cn.md | 38 ++++++++++++++++++++++++++------------ README.zh-tw.md | 38 ++++++++++++++++++++++++++------------ 3 files changed, 65 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 71e8bb7..d769662 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ jobs: runs-on: ubuntu-latest steps: - name: executing remote ssh commands using password - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: linuxserver.io @@ -184,7 +184,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```yaml - name: executing remote ssh commands using password - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -197,7 +197,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```yaml - name: executing remote ssh commands using ssh key - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -210,7 +210,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```yaml - name: multiple command - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -227,7 +227,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```yaml - name: file commands - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -240,7 +240,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```diff - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: - host: "foo.com" + host: "foo.com,bar.com" @@ -258,7 +258,7 @@ The default value of `port` is `22`. ```diff - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: - host: "foo.com" + host: "foo.com:1234,bar.com:5678" @@ -273,7 +273,7 @@ The default value of `port` is `22`. ```diff - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: "foo.com,bar.com" + sync: true @@ -289,7 +289,7 @@ The default value of `port` is `22`. ```diff - name: pass environment - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 + env: + FOO: "BAR" + BAR: "FOO" @@ -314,7 +314,7 @@ _Inside `env` object, you need to pass every environment variable as a string, p ```diff - name: stop script if command error - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -367,7 +367,7 @@ Host FooServer ```diff - name: ssh proxy command - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -390,7 +390,7 @@ It is not uncommon for files to leak from backups or decommissioned hardware, an ```diff - name: ssh key passphrase - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -416,7 +416,7 @@ Now you can adjust you config: ```diff - name: ssh key passphrase - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} diff --git a/README.zh-cn.md b/README.zh-cn.md index 6e7e69d..3a52957 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -24,6 +24,7 @@ * `key_path` - SSH 私钥的路径 * `fingerprint` - 主机公钥的 SHA256 指纹,默认为跳过验证 * `script` - 执行命令 +* `script_file` - 執行命令的文件 * `script_stop` - 当出现第一个错误时停止执行命令 * `envs` - 传递环境变量到 shell script * `debug` - 启用调试模式 @@ -58,7 +59,7 @@ jobs: runs-on: ubuntu-latest steps: - name: executing remote ssh commands using password - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -157,7 +158,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“ ```yaml - name: executing remote ssh commands using password - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -170,7 +171,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“ ```yaml - name: executing remote ssh commands using ssh key - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -183,7 +184,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“ ```yaml - name: multiple command - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -200,7 +201,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“ ```diff - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: - host: ”foo.com“ + host: ”foo.com,bar.com“ @@ -212,11 +213,24 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“ 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 - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: - host: ”foo.com“ + host: ”foo.com:1234,bar.com:5678“ @@ -231,7 +245,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“ ```diff - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ”foo.com,bar.com“ + sync: true @@ -247,7 +261,7 @@ ssh-keygen -t ed25519 -a 200 -C ”your_email@example.com“ ```diff - name: pass environment - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 + env: + FOO: ”BAR“ + BAR: ”FOO“ @@ -272,7 +286,7 @@ _在 `env` 对象中,您需要将每个环境变量作为字符串传递,传 ```diff - name: stop script if command error - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -325,7 +339,7 @@ Host FooServer ```diff - name: ssh proxy command - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -346,7 +360,7 @@ Host FooServer ```diff - name: ssh key passphrase - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -372,7 +386,7 @@ ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ’ ```diff - name: ssh key passphrase - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} diff --git a/README.zh-tw.md b/README.zh-tw.md index b5674f3..3b4246b 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -24,6 +24,7 @@ * `key_path` - SSH 私鑰的路徑 * `fingerprint` - 主機公鑰的 SHA256 指紋,預設為略過驗證 * `script` - 執行命令 +* `script_file` - 執行命令的文件 * `script_stop` - 當出現第一個錯誤時停止執行命令 * `envs` - 傳遞環境變數到 shell script * `debug` - 啟用偵錯模式 @@ -58,7 +59,7 @@ jobs: runs-on: ubuntu-latest steps: - name: executing remote ssh commands using password - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -157,7 +158,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```yaml - name: executing remote ssh commands using password - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -170,7 +171,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```yaml - name: executing remote ssh commands using ssh key - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -183,7 +184,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```yaml - name: multiple command - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -196,11 +197,24 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ![result](./images/output-result.png) +#### 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 - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: - host: "foo.com" + host: "foo.com,bar.com" @@ -216,7 +230,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```diff - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: - host: "foo.com" + host: "foo.com:1234,bar.com:5678" @@ -231,7 +245,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```diff - name: multiple host - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: "foo.com,bar.com" + sync: true @@ -247,7 +261,7 @@ ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ```diff - name: pass environment - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 + env: + FOO: "BAR" + BAR: "FOO" @@ -272,7 +286,7 @@ _在 `env` 對象中,您需要將每個環境變量作為字符串傳遞,傳 ```diff - name: stop script if command error - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -325,7 +339,7 @@ Host FooServer ```diff - name: ssh proxy command - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -346,7 +360,7 @@ Host FooServer ```diff - name: ssh key passphrase - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -372,7 +386,7 @@ ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ' ' ```diff - name: ssh key passphrase - uses: appleboy/ssh-action@v1.1.0 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} From 8fdfeb034ef6e9033a8a4407975aedbc12a08737 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 15:17:02 +0800 Subject: [PATCH 08/12] chore(github): update `appleboy/ssh-action` to version `v1.2.0` across workflows - Update `appleboy/ssh-action` from version `v1.0.3` to `v1.2.0` in bug report template - Update `appleboy/ssh-action` from version `v1.0.3` to `v1.2.0` in stable workflow Signed-off-by: appleboy --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/workflows/stable.yml | 32 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 6e2dcf4..5270fdf 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - name: executing remote ssh commands using password - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index ce98c8e..29ea7fa 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -31,7 +31,7 @@ jobs: sleep 2 - name: ssh by username and password - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -86,7 +86,7 @@ jobs: sleep 2 - name: ssh by private key - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -95,7 +95,7 @@ jobs: script: whoami - name: wrong password but correct key - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -105,7 +105,7 @@ jobs: script: whoami - name: correct password but wrong key - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -115,7 +115,7 @@ jobs: script: whoami - name: stop script if command error - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 continue-on-error: true with: host: ${{ env.REMOTE_HOST }} @@ -174,7 +174,7 @@ jobs: sleep 2 - name: ssh key passphrase - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -186,7 +186,7 @@ jobs: ls -al - name: missing ssh key passphrase - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 continue-on-error: true with: host: ${{ env.REMOTE_HOST }} @@ -199,7 +199,7 @@ jobs: # https://github.com/appleboy/ssh-action/issues/75#issuecomment-668314271 - name: Multiline SSH commands interpreted as single lines - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -277,7 +277,7 @@ jobs: # https://github.com/appleboy/ssh-action/issues/85 - name: Deployment to multiple hosts with different ports - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: "${{ env.REMOTE_HOST_01 }}:2222,${{ env.REMOTE_HOST_02 }}:2222" username: linuxserver.io @@ -331,7 +331,7 @@ jobs: sleep 2 - name: testing id_ed25519 key - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -384,7 +384,7 @@ jobs: sleep 2 - name: testing id_ed25519 key - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io @@ -395,7 +395,7 @@ jobs: ls -al - name: pass environment - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 env: FOO: "BAR" with: @@ -409,7 +409,7 @@ jobs: echo "I am $BAR, thanks" - name: pass multiple environment - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 env: FOO: "BAR" BAR: "FOO" @@ -428,7 +428,7 @@ jobs: echo "port: $PORT" - name: custom envs format - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 env: FOO: "BAR" AAA: "BBB" @@ -446,7 +446,7 @@ jobs: echo "I am $TEST_AAA, thanks" - name: pass all ENV variables to script - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 env: INPUT_FOO: "BAR" INPUT_AAA: "BBB" @@ -463,7 +463,7 @@ jobs: echo "$GITHUB_REF" - name: switch to root user - uses: appleboy/ssh-action@v1.0.3 + uses: appleboy/ssh-action@v1.2.0 with: host: ${{ env.REMOTE_HOST }} username: linuxserver.io From a8952ebe2a1428de1644645b937cea45ed655b67 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 15:51:42 +0800 Subject: [PATCH 09/12] docs(readme): update documentation for GitHub Actions and Docker support - Update README badges to reflect the new GitHub Actions workflow - Remove outdated information about Linux Docker container support in README files Signed-off-by: appleboy --- README.md | 4 +--- README.zh-cn.md | 4 +--- README.zh-tw.md | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d769662..58e9738 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,7 @@ ![ssh workflow](./images/ssh-workflow.png) -[![Actions Status](https://github.com/appleboy/ssh-action/workflows/remote%20ssh%20command/badge.svg)](https://github.com/appleboy/ssh-action/actions) - -**Important**: Only support **Linux** [docker](https://www.docker.com/) container. +[![testing main branch](https://github.com/appleboy/ssh-action/actions/workflows/main.yml/badge.svg)](https://github.com/appleboy/ssh-action/actions/workflows/main.yml) This thing is built using [Golang](https://go.dev) and [drone-ssh](https://github.com/appleboy/drone-ssh). 🚀 diff --git a/README.zh-cn.md b/README.zh-cn.md index 3a52957..98505f4 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -4,9 +4,7 @@ ![ssh workflow](./images/ssh-workflow.png) -[![Actions Status](https://github.com/appleboy/ssh-action/workflows/remote%20ssh%20command/badge.svg)](https://github.com/appleboy/ssh-action/actions) - -**注意**: 只支持在 **Linux** [docker](https://www.docker.com/) 容器上执行。 +[![testing main branch](https://github.com/appleboy/ssh-action/actions/workflows/main.yml/badge.svg)](https://github.com/appleboy/ssh-action/actions/workflows/main.yml) ## 输入变量 diff --git a/README.zh-tw.md b/README.zh-tw.md index 3b4246b..fe9e71f 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -4,9 +4,7 @@ ![ssh workflow](./images/ssh-workflow.png) -[![Actions Status](https://github.com/appleboy/ssh-action/workflows/remote%20ssh%20command/badge.svg)](https://github.com/appleboy/ssh-action/actions) - -**注意**: 只支援在 **Linux** [docker](https://www.docker.com/) 容器上執行。 +[![testing main branch](https://github.com/appleboy/ssh-action/actions/workflows/main.yml/badge.svg)](https://github.com/appleboy/ssh-action/actions/workflows/main.yml) ## 輸入變數 From cec69ef2315fa7868468f4283007628aa37a6b7e Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 15:53:54 +0800 Subject: [PATCH 10/12] docs(readme): standardize terminology and capitalization across project - Capitalize "SSH" in multiple instances for consistency - Change "This thing" to "This project" for clarity and professionalism - Capitalize "Pass" in the description of the `allenvs` option Signed-off-by: appleboy --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 58e9738..0a204a3 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ [繁體中文](./README.zh-tw.md) [简体中文](./README.zh-cn.md) -[GitHub Action](https://github.com/features/actions) for executing remote ssh commands. +[GitHub Action](https://github.com/features/actions) for executing remote SSH commands. ![ssh workflow](./images/ssh-workflow.png) [![testing main branch](https://github.com/appleboy/ssh-action/actions/workflows/main.yml/badge.svg)](https://github.com/appleboy/ssh-action/actions/workflows/main.yml) -This thing is built using [Golang](https://go.dev) and [drone-ssh](https://github.com/appleboy/drone-ssh). 🚀 +This project is built using [Golang](https://go.dev) and [drone-ssh](https://github.com/appleboy/drone-ssh). 🚀 ## Input variables @@ -49,12 +49,12 @@ See [action.yml](./action.yml) for more detailed information. | envs | Pass environment variables to shell script | | | envs_format | Flexible configuration of environment value transfer | | | 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 | ## Usage -Executing remote ssh commands. +Executing remote SSH commands. ```yaml name: remote ssh command From a9e2fdf08d46817c815611f3989f7757048795bd Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 17 Nov 2024 16:00:24 +0800 Subject: [PATCH 11/12] docs(readme): improve README structure and add new input variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update title to remove redundant "用於" - Add links to English and Simplified Chinese versions of the README - Add a note about the project using Golang and drone-ssh - Replace detailed input variable descriptions with a table format - Add new input variables `protocol`, `proxy_protocol`, `envs_format`, `allenvs`, and `request_pty` - Update usage section to refer to `action.yml` for detailed information Signed-off-by: appleboy --- README.zh-tw.md | 81 +++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/README.zh-tw.md b/README.zh-tw.md index fe9e71f..324cba8 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -1,49 +1,58 @@ -# 🚀 用於 GitHub Actions 的 SSH +# 🚀 GitHub Actions 的 SSH -[GitHub Action](https://github.com/features/actions) for executing remote ssh commands. +[English](./README.md) +[简体中文](./README.zh-cn.md) + +[GitHub Action](https://github.com/features/actions) 用於執行遠端 SSH 命令。 ![ssh workflow](./images/ssh-workflow.png) [![testing main branch](https://github.com/appleboy/ssh-action/actions/workflows/main.yml/badge.svg)](https://github.com/appleboy/ssh-action/actions/workflows/main.yml) +此專案使用 [Golang](https://go.dev) 和 [drone-ssh](https://github.com/appleboy/drone-ssh) 建立。🚀 + ## 輸入變數 -更詳細的資訊,請參閱 [action.yml](./action.yml)。 +請參閱 [action.yml](./action.yml) 以獲取更詳細的信息。 -* `host` - SSH 主機 -* `port` - SSH 連接埠,預設為 `22` -* `username` - SSH 使用者名稱 -* `password` - SSH 密碼 -* `passphrase` - 通常用於加密私鑰的 passphrase -* `sync` - 同步執行多個主機上的命令,預設為 false -* `timeout` - SSH 連接到遠端主機的超時時間,預設為 `30s` -* `command_timeout` - SSH 命令超時時間,預設為 10m -* `key` - SSH 私鑰的內容,例如 ~/.ssh/id_rsa 的原始內容,請記得包含 BEGIN 和 END 行 -* `key_path` - SSH 私鑰的路徑 -* `fingerprint` - 主機公鑰的 SHA256 指紋,預設為略過驗證 -* `script` - 執行命令 -* `script_file` - 執行命令的文件 -* `script_stop` - 當出現第一個錯誤時停止執行命令 -* `envs` - 傳遞環境變數到 shell script -* `debug` - 啟用偵錯模式 -* `use_insecure_cipher` - 使用不安全的密碼(ciphers)進行加密,參見 [#56](https://github.com/appleboy/ssh-action/issues/56) -* `cipher` - 允許使用的密碼(ciphers)演算法。如果未指定,則使用適當的演算法 +| 輸入參數 | 描述 | 預設值 | +| ------------------------- | ----------------------------------------------------- | ------ | +| host | SSH 主機地址 | | +| port | SSH 埠號 | 22 | +| passphrase | SSH 金鑰密碼 | | +| username | SSH 使用者名稱 | | +| password | SSH 密碼 | | +| protocol | SSH 協議版本 (tcp, tcp4, tcp6) | tcp | +| sync | 如果有多個主機,啟用同步執行 | false | +| use_insecure_cipher | 包含更多不安全的加密算法 | false | +| cipher | 允許的加密算法。如果未指定,則使用合理的預設值 | | +| timeout | SSH 連接主機的超時時間 | 30s | +| command_timeout | SSH 命令的超時時間 | 10m | +| key | SSH 私鑰的內容。例如,~/.ssh/id_rsa 的原始內容 | | +| key_path | SSH 私鑰的路徑 | | +| fingerprint | 主機公鑰的 SHA256 指紋 | | +| proxy_host | SSH 代理主機 | | +| proxy_port | SSH 代理埠號 | 22 | +| proxy_protocol | SSH 代理協議版本 (tcp, tcp4, tcp6) | tcp | +| proxy_username | SSH 代理使用者名稱 | | +| proxy_password | SSH 代理密碼 | | +| proxy_passphrase | SSH 代理金鑰密碼 | | +| proxy_timeout | SSH 連接代理主機的超時時間 | 30s | +| proxy_key | SSH 代理私鑰的內容 | | +| proxy_key_path | SSH 代理私鑰的路徑 | | +| proxy_fingerprint | 代理主機公鑰的 SHA256 指紋 | | +| proxy_cipher | 代理允許的加密算法 | | +| proxy_use_insecure_cipher | 包含更多不安全的加密算法 | false | +| script | 執行命令 | | +| script_file | 從文件中執行命令 | | +| script_stop | 在第一次失敗後停止腳本 | false | +| envs | 將環境變數傳遞給 shell 腳本 | | +| envs_format | 環境值傳遞的靈活配置 | | +| debug | 啟用調試模式 | false | +| allenvs | 將帶有 `GITHUB_` 和 `INPUT_` 前綴的環境變數傳遞給腳本 | false | +| request_pty | 從伺服器請求偽終端 | false | -SSH 代理設置: - -* `proxy_host` - 代理主機 -* `proxy_port` - 代理端口,預設為 `22` -* `proxy_username` - 代理使用者名稱 -* `proxy_password` - 代理密碼 -* `proxy_passphrase` - 密碼通常用於加密私有金鑰 -* `proxy_timeout` - SSH 連線至代理主機的逾時時間,預設為 `30s` -* `proxy_key` - SSH 代理私有金鑰內容 -* `proxy_key_path` - SSH 代理私有金鑰路徑 -* `proxy_fingerprint` - 代理主機公鑰的 SHA256 指紋,預設為跳過驗證 -* `proxy_use_insecure_cipher` - 使用不安全的加密方式,請參閱 [#56](https://github.com/appleboy/ssh-action/issues/56) -* `proxy_cipher` - 允許的加密算法。如果未指定,則使用合理的算法 - -## 使用方式 +## 用法 執行遠端 SSH 命令 From 43d4ebbb72699ed0e9e8aeead91adfc4eac75ed6 Mon Sep 17 00:00:00 2001 From: Kyle Leonhard Date: Sun, 17 Nov 2024 16:57:32 -0800 Subject: [PATCH 12/12] chore: Add test to stable workflow for script_path (#347) --- .github/workflows/stable.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 29ea7fa..9209737 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -42,6 +42,15 @@ jobs: set -e whoami + - name: ssh commands from a file + uses: appleboy/ssh-action@v1.2.0 + with: + host: ${{ env.REMOTE_HOST }} + username: linuxserver.io + password: password + port: 2222 + script_path: testdata/test.sh + check-ssh-key: runs-on: ubuntu-latest steps: