From 8b7c180c3f580afe122426543bdc249057f89fa1 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 12:45:00 +0800 Subject: [PATCH 1/8] ci: add comprehensive GitHub Actions tests for scp-action - Add GitHub Actions workflow to test multiple scp-action configurations and scenarios - Include job to test deployment of uploaded and downloaded artifacts via scp - Include job to copy only changed files detected by tj-actions/changed-files - Add test for stripping leading path components when copying files - Add coverage for copying files to single and multiple hosts, including target folder variations - Test scp-action usage with both SSH key and password authentication, with and without passphrases, and option for insecure cipher Signed-off-by: appleboy --- .github/workflows/stable.yml | 150 +++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/stable.yml diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml new file mode 100644 index 0000000..21fe5b6 --- /dev/null +++ b/.github/workflows/stable.yml @@ -0,0 +1,150 @@ +name: testing v1 +on: [push] +jobs: + testing: + name: test scp action + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: copy file via ssh password + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "test" + + - name: copy file via ssh key + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "test" + + - name: remove the specified number of leading path elements + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "foobar" + strip_components: 1 + + - name: ssh key with passphrase + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH2 }} + passphrase: ${{ secrets.PASSPHRASE }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "test" + + - name: use insecure cipher + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH2 }} + passphrase: ${{ secrets.PASSPHRASE }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "test" + use_insecure_cipher: true + + deploy: + name: test deploy artifact + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - run: echo hello > world.txt + + - uses: actions/upload-artifact@v4 + with: + name: my-artifact + path: world.txt + + - uses: actions/download-artifact@v4 + with: + name: my-artifact + path: distfiles + + - name: copy file to server + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: distfiles/* + target: test + + changes: + name: test changed-files + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + with: + since_last_remote_commit: true + separator: "," + + - name: copy file to server + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: ${{ steps.changed-files.outputs.all_changed_files }} + target: test + + target: + name: test target folder + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: copy file to server + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: tests/a.txt,tests/b.txt + target: foobar foobar 1234 + + multipleHost: + name: test Multiple Host + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: copy file to server + uses: appleboy/scp-action@v1 + with: + host: ${{ secrets.HOST }}:${{ secrets.PORT }},${{ secrets.HOST }}:${{ secrets.PORT }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: 1024 + source: tests/a.txt,tests/b.txt + target: foobar -- 2.54.0 From 35c03a241dbc07b1b990e91b815f005491b649fc Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 12:46:01 +0800 Subject: [PATCH 2/8] ci: rename testing workflow to clarify versioning - Update workflow name from "testing v1" to "v1 version" Signed-off-by: appleboy --- .github/workflows/stable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 21fe5b6..0d105a5 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -1,4 +1,4 @@ -name: testing v1 +name: v1 version on: [push] jobs: testing: -- 2.54.0 From 7f18bf0ec86d81d9fba5e2bdf3253b7b22a604ab Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 12:46:41 +0800 Subject: [PATCH 3/8] docs: add v1 workflow version badge to all README files - Add a v1 version badge for the stable workflow to all README files Signed-off-by: appleboy --- README.md | 1 + README.zh-cn.md | 1 + README.zh-tw.md | 1 + 3 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 271da8a..eb7c683 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [GitHub Action](https://github.com/features/actions) for copying files and artifacts via SSH. +[![v1 version](https://github.com/appleboy/scp-action/actions/workflows/stable.yml/badge.svg)](https://github.com/appleboy/scp-action/actions/workflows/stable.yml) [![lint and test](https://github.com/appleboy/scp-action/actions/workflows/testing.yml/badge.svg)](https://github.com/appleboy/scp-action/actions/workflows/testing.yml) > **Note:** Only supports **Linux** [docker](https://www.docker.com/) containers. diff --git a/README.zh-cn.md b/README.zh-cn.md index 52994b7..4fe61eb 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -4,6 +4,7 @@ [GitHub Action](https://github.com/features/actions) 用于通过 SSH 复制文件和构建产物。 +[![v1 version](https://github.com/appleboy/scp-action/actions/workflows/stable.yml/badge.svg)](https://github.com/appleboy/scp-action/actions/workflows/stable.yml) [![lint and test](https://github.com/appleboy/scp-action/actions/workflows/testing.yml/badge.svg)](https://github.com/appleboy/scp-action/actions/workflows/testing.yml) > **注意:** 仅支持 **Linux** [docker](https://www.docker.com/) 容器。 diff --git a/README.zh-tw.md b/README.zh-tw.md index 2a0e4a6..9b39b42 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -4,6 +4,7 @@ [GitHub Action](https://github.com/features/actions) 用於透過 SSH 複製檔案與產物。 +[![v1 version](https://github.com/appleboy/scp-action/actions/workflows/stable.yml/badge.svg)](https://github.com/appleboy/scp-action/actions/workflows/stable.yml) [![lint and test](https://github.com/appleboy/scp-action/actions/workflows/testing.yml/badge.svg)](https://github.com/appleboy/scp-action/actions/workflows/testing.yml) > **注意:** 只支援 **Linux** [docker](https://www.docker.com/) 容器。 -- 2.54.0 From 9132c85c5fa410e8dfbdc94fd5f20fa3e6d165db Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 31 Aug 2025 10:04:38 +0800 Subject: [PATCH 4/8] ci: update GitHub Actions to latest major versions - Update actions/checkout to version 5 throughout workflow files - Update actions/download-artifact to version 5 - Update tj-actions/changed-files to version 46 in the testing workflow Signed-off-by: appleboy --- .github/workflows/stable.yml | 12 ++++++------ .github/workflows/testing.yml | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 0d105a5..421bdfd 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: copy file via ssh password uses: appleboy/scp-action@v1 @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - run: echo hello > world.txt @@ -76,7 +76,7 @@ jobs: name: my-artifact path: world.txt - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v5 with: name: my-artifact path: distfiles @@ -96,7 +96,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Get changed files id: changed-files @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: copy file to server uses: appleboy/scp-action@v1 @@ -137,7 +137,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: copy file to server uses: appleboy/scp-action@v1 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d9d40ab..618fd44 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: copy file via ssh password uses: ./ @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - run: echo hello > world.txt @@ -76,7 +76,7 @@ jobs: name: my-artifact path: world.txt - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v5 with: name: my-artifact path: distfiles @@ -96,11 +96,11 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@v46 with: since_last_remote_commit: true separator: "," @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: copy file to server uses: ./ @@ -137,7 +137,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: copy file to server uses: ./ -- 2.54.0 From eb443bd4941c3334ee584c1915fcfa2001e8a86c Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 31 Aug 2025 10:31:45 +0800 Subject: [PATCH 5/8] feat: avoid redundant binary downloads and notify when skipping (#210) * feat: avoid redundant binary downloads and notify when skipping - Skip downloading the binary if it already exists, and print a message instead Signed-off-by: appleboy * Update entrypoint.sh Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Signed-off-by: appleboy Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index bc99822..f9449e8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -39,8 +39,12 @@ if [[ "${INPUT_CURL_INSECURE}" == 'true' ]]; then INSECURE_OPTION="--insecure" fi -curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}" -chmod +x "${TARGET}" +if [[ ! -x "${TARGET}" ]]; then + curl -fsSL --retry 5 --keepalive-time 2 ${INSECURE_OPTION} "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o "${TARGET}" + chmod +x "${TARGET}" +else + echo "Binary ${CLIENT_BINARY} already exists and is executable, skipping download." +fi echo "======= CLI Version Information =======" "${TARGET}" --version -- 2.54.0 From 7179e72a3fa4d4c33870a471708fda724fae7596 Mon Sep 17 00:00:00 2001 From: appleboy Date: Tue, 16 Sep 2025 22:58:49 +0800 Subject: [PATCH 6/8] ci: update GitHub workflows to use latest action versions - Update actions/setup-go to v6 in the goreleaser workflow - Update tj-actions/changed-files to v47 in stable and testing workflows Signed-off-by: appleboy --- .github/workflows/goreleaser.yml | 2 +- .github/workflows/stable.yml | 2 +- .github/workflows/testing.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 7f1ae24..9292bd8 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 0 - name: Setup go - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: "^1" diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 421bdfd..3180653 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v45 + uses: tj-actions/changed-files@v47 with: since_last_remote_commit: true separator: "," diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 618fd44..4273e38 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v46 + uses: tj-actions/changed-files@v47 with: since_last_remote_commit: true separator: "," -- 2.54.0 From a6e43c3aaf4e8e6b0b15bf34e19d71118f6b1ca7 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 28 Mar 2026 12:06:40 +0800 Subject: [PATCH 7/8] chore(ci): update GitHub Actions dependencies to latest versions Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/goreleaser.yml | 4 ++-- .github/workflows/stable.yml | 14 +++++++------- .github/workflows/testing.yml | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 9292bd8..f90581e 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -23,7 +23,7 @@ jobs: go-version: "^1" - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 + uses: goreleaser/goreleaser-action@v7 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 3180653..1da67e3 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: copy file via ssh password uses: appleboy/scp-action@v1 @@ -67,16 +67,16 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - run: echo hello > world.txt - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: my-artifact path: world.txt - - uses: actions/download-artifact@v5 + - uses: actions/download-artifact@v8 with: name: my-artifact path: distfiles @@ -96,7 +96,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Get changed files id: changed-files @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: copy file to server uses: appleboy/scp-action@v1 @@ -137,7 +137,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: copy file to server uses: appleboy/scp-action@v1 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 4273e38..f996f6d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: copy file via ssh password uses: ./ @@ -67,16 +67,16 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - run: echo hello > world.txt - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: my-artifact path: world.txt - - uses: actions/download-artifact@v5 + - uses: actions/download-artifact@v8 with: name: my-artifact path: distfiles @@ -96,7 +96,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Get changed files id: changed-files @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: copy file to server uses: ./ @@ -137,7 +137,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: copy file to server uses: ./ -- 2.54.0 From 5bb815ae7f76baf13e1646dc59b8239beeb6ed57 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 23 Jun 2026 20:07:08 +0800 Subject: [PATCH 8/8] chore(ci): update GitHub Actions dependencies to latest versions - Bump actions/checkout from v6 to v7 --- .github/workflows/goreleaser.yml | 2 +- .github/workflows/stable.yml | 10 +++++----- .github/workflows/testing.yml | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index f90581e..ff7b91e 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 with: fetch-depth: 0 diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 1da67e3..c4665a5 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: copy file via ssh password uses: appleboy/scp-action@v1 @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - run: echo hello > world.txt @@ -96,7 +96,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Get changed files id: changed-files @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: copy file to server uses: appleboy/scp-action@v1 @@ -137,7 +137,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: copy file to server uses: appleboy/scp-action@v1 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f996f6d..be05e5a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: copy file via ssh password uses: ./ @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - run: echo hello > world.txt @@ -96,7 +96,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: Get changed files id: changed-files @@ -120,7 +120,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: copy file to server uses: ./ @@ -137,7 +137,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v6 + uses: actions/checkout@v7 - name: copy file to server uses: ./ -- 2.54.0