From 6291b9e86b3ac9814fc46683adda518814e3a609 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Jun 2022 22:11:02 +0800 Subject: [PATCH 01/69] chore(deps): bump actions/checkout from 1 to 3 (#81) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09d204b..19caa84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: copy file via ssh password uses: ./ -- 2.54.0 From 2ce642f289702dc78338c4d35466f89ecfee375c Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 15 Jun 2022 22:13:20 +0800 Subject: [PATCH 02/69] chore: enable funding button --- .github/FUNDING.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..df9ae63 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: ['https://www.paypal.me/appleboy46'] -- 2.54.0 From 7f8a7c101927aef7e69d0a742cda97fff2714662 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 30 Jul 2022 10:23:52 +0800 Subject: [PATCH 03/69] docs: add new section: Setting up a SSH Key Signed-off-by: Bo-Yi Wu --- README.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/README.md b/README.md index a2d42a3..9fa93f0 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,111 @@ SSH Proxy Setting: * proxy_fingerprint - fingerprint SHA256 of the host public key, default is to skip verification * proxy_use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) +### Setting up a SSH Key + +Make sure to follow the below steps while creating SSH Keys and using them. +The best practice is create the SSH Keys on local machine not remote machine. +Login with username specified in Github Secrets. Generate a RSA Key-Pair: + +
+rsa +

+ +```bash +ssh-keygen -t rsa -b 4096 -C "your_email@example.com" +``` + +

+
+ +
+ed25519 +

+ +```bash +ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" +``` + +

+
+ +Add newly generated key into Authorized keys. Read more about authorized keys [here](https://www.ssh.com/ssh/authorized_keys/). + +
+rsa +

+ +```bash +cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys' +``` + +

+
+ +
+ed25519 +

+ +```bash +cat .ssh/id_ed25519.pub | ssh b@B 'cat >> .ssh/authorized_keys' +``` + +

+
+ +Copy Private Key content and paste in Github Secrets. + +
+rsa +

+ +```bash +clip < ~/.ssh/id_rsa +``` + +

+
+ +
+ed25519 +

+ +```bash +clip < ~/.ssh/id_ed25519 +``` + +

+
+ +See the detail information about [SSH login without password](http://www.linuxproblem.org/art_9.html). + +**A note** from one of our readers: Depending on your version of SSH you might also have to do the following changes: + +* Put the public key in `.ssh/authorized_keys2` +* Change the permissions of `.ssh` to 700 +* Change the permissions of `.ssh/authorized_keys2` to 640 + +### If you are using OpenSSH + +If you are currently using OpenSSH and are getting the following error: + +```bash +ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey] +``` + +Make sure that your key algorithm of choice is supported. On Ubuntu 20.04 or later you must explicitly allow the use of the ssh-rsa algorithm. Add the following line to your OpenSSH daemon file (which is either `/etc/ssh/sshd_config` or a drop-in file under +`/etc/ssh/sshd_config.d/`): + +```bash +CASignatureAlgorithms +ssh-rsa +``` + +Alternatively, `ed25519` keys are accepted by default in OpenSSH. You could use this instead of rsa if needed: + +```bash +ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" +``` + ### Example Copy file via a SSH password: -- 2.54.0 From 9ec0623f29bc88eceec57c79de90899470809b17 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 30 Jul 2022 10:28:44 +0800 Subject: [PATCH 04/69] docs: fix format Signed-off-by: Bo-Yi Wu --- README.md | 60 +++++++++---------------------------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 9fa93f0..1f9141d 100644 --- a/README.md +++ b/README.md @@ -66,82 +66,40 @@ SSH Proxy Setting: * proxy_fingerprint - fingerprint SHA256 of the host public key, default is to skip verification * proxy_use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) -### Setting up a SSH Key +## Setting up a SSH Key Make sure to follow the below steps while creating SSH Keys and using them. The best practice is create the SSH Keys on local machine not remote machine. Login with username specified in Github Secrets. Generate a RSA Key-Pair: -
-rsa -

- ```bash +# rsa ssh-keygen -t rsa -b 4096 -C "your_email@example.com" -``` -

-
- -
-ed25519 -

- -```bash +# ed25519 ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ``` -

-
- Add newly generated key into Authorized keys. Read more about authorized keys [here](https://www.ssh.com/ssh/authorized_keys/). -
-rsa -

- ```bash +# rsa cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys' -``` -

-
- -
-ed25519 -

- -```bash +# d25519 cat .ssh/id_ed25519.pub | ssh b@B 'cat >> .ssh/authorized_keys' ``` -

-
- Copy Private Key content and paste in Github Secrets. -
-rsa -

- ```bash +# rsa clip < ~/.ssh/id_rsa -``` -

-
- -
-ed25519 -

- -```bash +# ed25519 clip < ~/.ssh/id_ed25519 ``` -

-
- See the detail information about [SSH login without password](http://www.linuxproblem.org/art_9.html). **A note** from one of our readers: Depending on your version of SSH you might also have to do the following changes: @@ -158,8 +116,8 @@ If you are currently using OpenSSH and are getting the following error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey] ``` -Make sure that your key algorithm of choice is supported. On Ubuntu 20.04 or later you must explicitly allow the use of the ssh-rsa algorithm. Add the following line to your OpenSSH daemon file (which is either `/etc/ssh/sshd_config` or a drop-in file under -`/etc/ssh/sshd_config.d/`): +Make sure that your key algorithm of choice is supported. +On Ubuntu 20.04 or later you must explicitly allow the use of the ssh-rsa algorithm. Add the following line to your OpenSSH daemon file (which is either `/etc/ssh/sshd_config` or a drop-in file under `/etc/ssh/sshd_config.d/`): ```bash CASignatureAlgorithms +ssh-rsa -- 2.54.0 From 98930d398ce425af0148ea8a0e3295cd04fe2b7a Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 30 Jul 2022 10:29:28 +0800 Subject: [PATCH 05/69] docs: fix format Signed-off-by: Bo-Yi Wu --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f9141d..75f0537 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Alternatively, `ed25519` keys are accepted by default in OpenSSH. You could use ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" ``` -### Example +## Example Copy file via a SSH password: -- 2.54.0 From 51b937b31f630852d36bbb161807b5a87b009e45 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 9 Apr 2023 11:57:45 +0800 Subject: [PATCH 06/69] feat: add new input for tar executable path (#102) - Add new input `tar_exec` with description and default value fix https://github.com/appleboy/drone-scp/issues/137 fix https://github.com/appleboy/scp-action/issues/83 --- README.md | 1 + action.yml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 75f0537..8bf6690 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ See the [action.yml](./action.yml) file for more detail information. * strip_components - remove the specified number of leading path elements. * overwrite - use `--overwrite` flag with tar * tar_tmp_path - temporary path for tar file on the dest host +* tar_exec - path to tar executable on the dest host. default is `tar` * use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) SSH Proxy Setting: diff --git a/action.yml b/action.yml index a0f8728..7a9f884 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,9 @@ inputs: default: false tar_tmp_path: description: 'temporary path for tar file on the dest host' + tar_exec: + description: 'temporary path for tar file on the dest host' + default: 'tar' proxy_host: description: 'ssh proxy remote host' proxy_port: -- 2.54.0 From 11c56b52d3cdc5e1d7822fdb3b8aea75b3092ca7 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sun, 9 Apr 2023 15:51:09 +0800 Subject: [PATCH 07/69] feat: update action.yml with new flags and descriptions - Update the `description` of `--overwrite` flag in `action.yml` - Add a new input `tar_dereference` with `--dereference` flag in `action.yml` Signed-off-by: Bo-Yi.Wu --- action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7a9f884..5ecab88 100644 --- a/action.yml +++ b/action.yml @@ -42,7 +42,10 @@ inputs: description: 'remove the specified number of leading path elements' default: 0 overwrite: - description: 'use `--overwrite` flag with tar' + description: 'use --overwrite flag with tar' + default: false + tar_dereference: + description: 'use --dereference flag with tar' default: false tar_tmp_path: description: 'temporary path for tar file on the dest host' -- 2.54.0 From dcb457bb6fb8f4da755c28f1231a0b7614050383 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sun, 9 Apr 2023 15:51:49 +0800 Subject: [PATCH 08/69] chore: add option to dereference symlinks in tar command - Add a flag to use `--dereference` with tar command Signed-off-by: Bo-Yi.Wu --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8bf6690..0d10cc5 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ See the [action.yml](./action.yml) file for more detail information. * overwrite - use `--overwrite` flag with tar * tar_tmp_path - temporary path for tar file on the dest host * tar_exec - path to tar executable on the dest host. default is `tar` +* tar_dereference - use `--dereference` flag with tar * use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) SSH Proxy Setting: -- 2.54.0 From 7cc0f645c7e110a10e3adfb4ae8b10e767b84589 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sun, 9 Apr 2023 15:54:48 +0800 Subject: [PATCH 09/69] docs: improve README.md explanations of tar flags - Update the `README.md` file with more details about tar flags - Replace `use --overwrite` with `overwrite existing files when extracting` in the `README.md` file - Replace `use --dereference` with `follow symlinks; archive and dump the files they point to` in the `README.md` file Signed-off-by: Bo-Yi.Wu --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0d10cc5..607f44a 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,10 @@ See the [action.yml](./action.yml) file for more detail information. * source - scp file list * rm - remove target folder before upload data, default is `false` * strip_components - remove the specified number of leading path elements. -* overwrite - use `--overwrite` flag with tar +* overwrite - use `--overwrite` flag with tar, overwrite existing files when extracting * tar_tmp_path - temporary path for tar file on the dest host * tar_exec - path to tar executable on the dest host. default is `tar` -* tar_dereference - use `--dereference` flag with tar +* tar_dereference - use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to * use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) SSH Proxy Setting: -- 2.54.0 From a4e63f0f1aa53e702b3228a78d59e0ffafaa0722 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sun, 9 Apr 2023 16:10:11 +0800 Subject: [PATCH 10/69] docs: add README configuration for custom file exclusions - Add configuration example for excluding custom files in README.md Signed-off-by: Bo-Yi.Wu --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 607f44a..72366ce 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,20 @@ Example configuration for multiple servers: target: "test" ``` +Example configuration for exclude custom files: + +```yaml + uses: appleboy/scp-action@master + with: + host: "example.com" + username: foo + password: bar + port: 22 +- source: "tests/*.txt" ++ source: "tests/*.txt,!tests/a.txt,!tests/b.txt" + target: "test" +``` + Remove the specified number of leading path elements: ```yaml -- 2.54.0 From d47875703ff9af01a2b632dc14b824aabdf5b1fa Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sun, 9 Apr 2023 16:38:43 +0800 Subject: [PATCH 11/69] docs: update target and source fields in README and action.yml descriptions - Change in README.md: Updated required fields for `target` and `source` - Change in action.yml: Updated description for `target` input field Signed-off-by: Bo-Yi.Wu --- README.md | 4 ++-- action.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 72366ce..7e7ddad 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ See the [action.yml](./action.yml) file for more detail information. * command_timeout - timeout for scp command, default is `10m` * key - content of ssh private key. ex raw content of ~/.ssh/id_rsa * key_path - path of ssh private key -* target - target path on the server -* source - scp file list +* target - target path on the server, must be a directory (**required**) +* source - scp file list (**required**) * rm - remove target folder before upload data, default is `false` * strip_components - remove the specified number of leading path elements. * overwrite - use `--overwrite` flag with tar, overwrite existing files when extracting diff --git a/action.yml b/action.yml index 5ecab88..a322c3d 100644 --- a/action.yml +++ b/action.yml @@ -29,7 +29,7 @@ inputs: description: 'include more ciphers with use_insecure_cipher' default: false target: - description: 'target path on the server' + description: 'target path on the server, must be a directory path.' source: description: 'scp file list' rm: -- 2.54.0 From c8e0cef94a42f8ebbec5bd20e792c1899823130c Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 9 Apr 2023 16:49:19 +0800 Subject: [PATCH 12/69] ci: add deployment workflow for artifact delivery (#103) - Add a deployment job to the CI workflow - Upload `world.txt` as an artifact - Download the artifact to the `distfiles` directory - Add a step to copy files to a server using SSH fix https://github.com/appleboy/scp-action/issues/35 --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++-- README.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19caa84..d6b679c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,8 @@ name: scp files on: [push] jobs: - build: - name: Build + testing: + name: test scp action runs-on: ubuntu-latest steps: - name: checkout @@ -62,3 +62,32 @@ jobs: source: "tests/a.txt,tests/b.txt" target: "test" use_insecure_cipher: true + + deploy: + name: deploy artifact + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - run: echo hello > world.txt + + - uses: actions/upload-artifact@v3 + with: + name: my-artifact + path: world.txt + + - uses: actions/download-artifact@v2 + with: + name: my-artifact + path: distfiles + + - name: copy file to server + uses: ./ + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: distfiles/* + target: test diff --git a/README.md b/README.md index 7e7ddad..55b1d3d 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,39 @@ Example configuration for exclude custom files: target: "test" ``` +Upload artifact files to remote server: + +```yaml + deploy: + name: deploy artifact + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - run: echo hello > world.txt + + - uses: actions/upload-artifact@v3 + with: + name: my-artifact + path: world.txt + + - uses: actions/download-artifact@v2 + with: + name: my-artifact + path: distfiles + + - name: copy file to server + uses: appleboy/scp-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: distfiles/* + target: test +``` + Remove the specified number of leading path elements: ```yaml -- 2.54.0 From 43abfa778d265c40bab39db5480df768142d9b80 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 9 Apr 2023 17:13:24 +0800 Subject: [PATCH 13/69] ci: add tests for incorrect scp-action authentication (#104) - Add two jobs to `.github/workflows/ci.yml` for testing scp-action with incorrect passwords and keys fix https://github.com/appleboy/scp-action/issues/86 --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6b679c..56839fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,28 @@ jobs: target: "test" use_insecure_cipher: true + - name: correct key but wrong password + uses: appleboy/scp-action@7af00892de6f8397c5c3393cfb3b32ae7f91b94b + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + password: abcdefg + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "test" + + - name: correct password but wrong key + uses: appleboy/scp-action@7af00892de6f8397c5c3393cfb3b32ae7f91b94b + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: abcdefg + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: "test" + deploy: name: deploy artifact runs-on: ubuntu-latest -- 2.54.0 From 6cd4f0cace8607947c1e20c77a39ed09f7259069 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 9 Apr 2023 18:10:17 +0800 Subject: [PATCH 14/69] ci: add automated deployment for changed files (#105) - Add a new job `changes` to the `ci.yml` file - Copy changed files to a server in the `changes` job - Add a YAML code block to the `README.md` file fix https://github.com/appleboy/scp-action/issues/73 --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ README.md | 28 ++++++++++++++++++++++++++++ tests/a.txt | 1 + tests/b.txt | 1 + tests/c.txt | 2 ++ tests/d.txt | 2 ++ 6 files changed, 58 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56839fd..516a8ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,3 +113,27 @@ jobs: port: ${{ secrets.PORT }} source: distfiles/* target: test + + changes: + name: test changed-files + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + since_last_remote_commit: true + separator: "," + + - name: copy file to server + uses: ./ + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: ${{ steps.changed-files.outputs.all_changed_files }} + target: test diff --git a/README.md b/README.md index 55b1d3d..9692c1d 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,34 @@ Remove the specified number of leading path elements: strip_components: 1 ``` +Only copy files that are newer than the corresponding destination files: + +```yaml + changes: + name: test changed-files + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + since_last_remote_commit: true + separator: "," + + - name: copy file to server + uses: appleboy/scp-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: ${{ steps.changed-files.outputs.all_changed_files }} + target: test +``` + Old target structure: ```sh diff --git a/tests/a.txt b/tests/a.txt index 257cc56..4f6c252 100644 --- a/tests/a.txt +++ b/tests/a.txt @@ -1 +1,2 @@ foo +foobar diff --git a/tests/b.txt b/tests/b.txt index 5716ca5..c494264 100644 --- a/tests/b.txt +++ b/tests/b.txt @@ -1 +1,2 @@ bar +foobar diff --git a/tests/c.txt b/tests/c.txt index f2ad6c7..06cab46 100644 --- a/tests/c.txt +++ b/tests/c.txt @@ -1 +1,3 @@ c +foobar +test1234 diff --git a/tests/d.txt b/tests/d.txt index 4bcfe98..13a80d9 100644 --- a/tests/d.txt +++ b/tests/d.txt @@ -1 +1,3 @@ d +foobar +foobar -- 2.54.0 From 8a92fcdb1eb4ffbf538b2fa286739760aac8a95b Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 9 Apr 2023 18:26:09 +0800 Subject: [PATCH 15/69] chore: upgrade drone-scp to v1.6.7 version. (#101) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7ccf9c5..9328506 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM appleboy/drone-scp:1.6.4-linux-amd64 +FROM ghcr.io/appleboy/drone-scp:1.6.7 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -- 2.54.0 From 3e84ad0651c115715648342293c4a914bc95be78 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sun, 9 Apr 2023 18:28:00 +0800 Subject: [PATCH 16/69] chore: update GitHub Actions and dependencies - Update the GitHub Actions `checkout` and `scp-action` versions. Signed-off-by: Bo-Yi.Wu --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9692c1d..8fa0b99 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v0.1.4 - name: copy file via ssh password - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -137,7 +137,7 @@ Copy file via a SSH password: ```yaml - name: copy file via ssh password - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: example.com username: foo @@ -151,7 +151,7 @@ Copy file via a SSH key: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -165,7 +165,7 @@ Example configuration for ignore list: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -178,7 +178,7 @@ Example configuration for ignore list: Example configuration for multiple servers: ```diff - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: - host: "example.com" + host: "foo.com,bar.com" @@ -192,7 +192,7 @@ Example configuration for multiple servers: Example configuration for exclude custom files: ```yaml - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: "example.com" username: foo @@ -226,7 +226,7 @@ Upload artifact files to remote server: path: distfiles - name: copy file to server - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -240,7 +240,7 @@ Remove the specified number of leading path elements: ```yaml - name: remove the specified number of leading path elements - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -269,7 +269,7 @@ Only copy files that are newer than the corresponding destination files: separator: "," - name: copy file to server - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -300,7 +300,7 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th ```diff - name: ssh key with passphrase - uses: appleboy/scp-action@master + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} -- 2.54.0 From e0dbae8ff09de5d43f99484848d1067b5ff1a125 Mon Sep 17 00:00:00 2001 From: "Bo-Yi.Wu" Date: Sun, 9 Apr 2023 18:29:40 +0800 Subject: [PATCH 17/69] chore: update target field path in multiple files - Change the `target` field value from `"test"` to `your_server_target_folder_path` in multiple places in the file. Signed-off-by: Bo-Yi.Wu --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8fa0b99..b423014 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ jobs: password: ${{ secrets.PASSWORD }} port: ${{ secrets.PORT }} source: "tests/a.txt,tests/b.txt" - target: "test" + target: your_server_target_folder_path ``` ## Input variables @@ -144,7 +144,7 @@ Copy file via a SSH password: password: bar port: 22 source: "tests/a.txt,tests/b.txt" - target: "test" + target: your_server_target_folder_path ``` Copy file via a SSH key: @@ -158,7 +158,7 @@ Copy file via a SSH key: port: ${{ secrets.PORT }} key: ${{ secrets.KEY }} source: "tests/a.txt,tests/b.txt" - target: "test" + target: your_server_target_folder_path ``` Example configuration for ignore list: @@ -172,7 +172,7 @@ Example configuration for ignore list: port: ${{ secrets.PORT }} key: ${{ secrets.KEY }} source: "tests/*.txt,!tests/a.txt" - target: "test" + target: your_server_target_folder_path ``` Example configuration for multiple servers: @@ -186,7 +186,7 @@ Example configuration for multiple servers: password: bar port: 22 source: "tests/a.txt,tests/b.txt" - target: "test" + target: your_server_target_folder_path ``` Example configuration for exclude custom files: @@ -200,7 +200,7 @@ Example configuration for exclude custom files: port: 22 - source: "tests/*.txt" + source: "tests/*.txt,!tests/a.txt,!tests/b.txt" - target: "test" + target: your_server_target_folder_path ``` Upload artifact files to remote server: @@ -233,7 +233,7 @@ Upload artifact files to remote server: key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} source: distfiles/* - target: test + target: your_server_target_folder_path ``` Remove the specified number of leading path elements: @@ -247,7 +247,7 @@ Remove the specified number of leading path elements: key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} source: "tests/a.txt,tests/b.txt" - target: "foobar" + target: your_server_target_folder_path strip_components: 1 ``` @@ -276,7 +276,7 @@ Only copy files that are newer than the corresponding destination files: key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} source: ${{ steps.changed-files.outputs.all_changed_files }} - target: test + target: your_server_target_folder_path ``` Old target structure: @@ -308,5 +308,5 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th + passphrase: ${{ secrets.PASSPHRASE }} port: ${{ secrets.PORT }} source: "tests/a.txt,tests/b.txt" - target: "test" + target: your_server_target_folder_path ``` -- 2.54.0 From 2cd029d317c18d3ebc928619d45e559cb8973e63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Apr 2023 11:05:43 +0800 Subject: [PATCH 18/69] chore(deps): bump actions/download-artifact from 2 to 3 (#109) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 516a8ab..66d88f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: name: my-artifact path: world.txt - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: my-artifact path: distfiles -- 2.54.0 From 82ebdbe3ed6023c66e5859d7e046aa79fcbf3ef1 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 15 Apr 2023 08:32:05 +0800 Subject: [PATCH 19/69] feat: support folder name contain space keyword (#110) - Rename a workflow job from `deploy artifact` to `test deploy artifact` - Add a new workflow job for copying files to a server ref https://github.com/appleboy/scp-action/issues/85 --- .github/workflows/ci.yml | 19 ++++++++++++++++++- Dockerfile | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66d88f8..b8658a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,7 +86,7 @@ jobs: target: "test" deploy: - name: deploy artifact + name: test deploy artifact runs-on: ubuntu-latest steps: - name: checkout @@ -137,3 +137,20 @@ jobs: 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@v3 + + - name: copy file to server + uses: ./ + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: tests/a.txt,tests/b.txt + target: test foobar diff --git a/Dockerfile b/Dockerfile index 9328506..57a9ad6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/appleboy/drone-scp:1.6.7 +FROM ghcr.io/appleboy/drone-scp:1.6.8 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -- 2.54.0 From 952a6e32508eb5e7b3b6b63acf0830a880ed01e5 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 16 Apr 2023 11:44:14 +0800 Subject: [PATCH 20/69] ci: refactor CI workflow to support multiple hosts (#115) - Add a new job to copy files to multiple hosts in the CI workflow fix https://github.com/appleboy/scp-action/issues/98 --- .github/workflows/ci.yml | 17 +++++++++++++++++ Dockerfile | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8658a7..8c9f5df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,3 +154,20 @@ jobs: port: ${{ secrets.PORT }} source: tests/a.txt,tests/b.txt target: test foobar + + multipleHost: + name: test Multiple Host + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: copy file to server + uses: ./ + 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 diff --git a/Dockerfile b/Dockerfile index 57a9ad6..519b741 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/appleboy/drone-scp:1.6.8 +FROM ghcr.io/appleboy/drone-scp:1.6.9 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -- 2.54.0 From c209399d24f9bdf90d1de61944c4c6be2232e6a0 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 16 Apr 2023 12:16:16 +0800 Subject: [PATCH 21/69] chore: update Docker image for drone-scp to version 1.6.10 (#116) - Update the `drone-scp` Docker image from version `1.6.9` to `1.6.10` fix https://github.com/appleboy/scp-action/issues/112 --- .github/workflows/ci.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c9f5df..119b12d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,7 +153,7 @@ jobs: key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} source: tests/a.txt,tests/b.txt - target: test foobar + target: foobar foobar 1234 multipleHost: name: test Multiple Host diff --git a/Dockerfile b/Dockerfile index 519b741..e44e0f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/appleboy/drone-scp:1.6.9 +FROM ghcr.io/appleboy/drone-scp:1.6.10 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -- 2.54.0 From cdeb36bbf942729104e80ff859d1edc61204b2fb Mon Sep 17 00:00:00 2001 From: m5chm3lz3r <120789813+m5chm3lz3r@users.noreply.github.com> Date: Sat, 20 May 2023 08:56:03 +0200 Subject: [PATCH 22/69] Update README.md (#123) --- README.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b423014..5dd96dd 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,23 @@ Remove the specified number of leading path elements: strip_components: 1 ``` +Old target structure: + +```sh +foobar + └── tests + ├── a.txt + └── b.txt +``` + +New target structure: + +```sh +foobar + ├── a.txt + └── b.txt +``` + Only copy files that are newer than the corresponding destination files: ```yaml @@ -279,23 +296,6 @@ Only copy files that are newer than the corresponding destination files: target: your_server_target_folder_path ``` -Old target structure: - -```sh -foobar - └── tests - ├── a.txt - └── b.txt -``` - -New target structure: - -```sh -foobar - ├── a.txt - └── b.txt -``` - Protecting a Private Key. The purpose of the passphrase is usually to encrypt the private key. This makes the key file by itself useless to an attacker. It is not uncommon for files to leak from backups or decommissioned hardware, and hackers commonly exfiltrate files from compromised systems. ```diff -- 2.54.0 From ec73feb85481e0cbd01ccabef32060aa92e8f9a2 Mon Sep 17 00:00:00 2001 From: Ilya Brin <464157+ilyabrin@users.noreply.github.com> Date: Sat, 20 May 2023 09:56:25 +0300 Subject: [PATCH 23/69] Update README.md (#125) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5dd96dd..c1d1879 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v0.1.4 + - uses: actions/checkout@v3 - name: copy file via ssh password uses: appleboy/scp-action@v0.1.4 with: @@ -220,7 +220,7 @@ Upload artifact files to remote server: name: my-artifact path: world.txt - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: my-artifact path: distfiles -- 2.54.0 From 11da0c97f92f76d4f8fae8fcfc6a4bf7c5dcd404 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Jun 2023 11:20:18 +0800 Subject: [PATCH 24/69] chore(deps): bump tj-actions/changed-files from 35 to 36 (#126) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 35 to 36. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v35...v36) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 119b12d..e622d8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v35 + uses: tj-actions/changed-files@v36 with: since_last_remote_commit: true separator: "," -- 2.54.0 From 7435be3541fd4fcd84583c2091a1543adf638514 Mon Sep 17 00:00:00 2001 From: Luxoruus <64335628+Luxoruus@users.noreply.github.com> Date: Fri, 21 Jul 2023 15:45:39 +0100 Subject: [PATCH 25/69] docs: Adding further instructions to Windows server users (#132) --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index c1d1879..d65dc95 100644 --- a/README.md +++ b/README.md @@ -310,3 +310,27 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th source: "tests/a.txt,tests/b.txt" target: your_server_target_folder_path ``` +When copying files from a Linux runner to a Windows server, you should: + +1. Download git for Windows +2. Change the default OpenSSH shell to git bach with the following powershell command: +```powershell +New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$env:Programfiles\Git\bin\bash.exe" -PropertyType String -Force +``` +3. Set `tar_dereference` and `rm` variable to `true` in the YAML file +4. Avoid putting the `port` value through a variable +5. Convert the target path to a Unix path: +```diff + - name: Copy to Windows + uses: appleboy/scp-action@v0.1.4 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + source: 'your_source_path' +- target: 'C:\path\to\target' ++ target: '/c/path/to/target/' ++ tar_dereference: true ++ rm: true +``` -- 2.54.0 From d47d818ab7df2fba3488bb41e64b26c4e3424190 Mon Sep 17 00:00:00 2001 From: appleboy Date: Fri, 21 Jul 2023 22:49:16 +0800 Subject: [PATCH 26/69] docs: improve OpenSSH setup and usage instructions - Corrected a typo in the instructions for changing the default OpenSSH shell to git bash - Added instructions to set `tar_dereference` and `rm` variable to `true` in the YAML file - Advised against putting the `port` value through a variable - Provided guidance on converting the target path to a Unix path: `/c/path/to/target/` Signed-off-by: appleboy --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d65dc95..2e38d9b 100644 --- a/README.md +++ b/README.md @@ -310,16 +310,23 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th source: "tests/a.txt,tests/b.txt" target: your_server_target_folder_path ``` + When copying files from a Linux runner to a Windows server, you should: -1. Download git for Windows -2. Change the default OpenSSH shell to git bach with the following powershell command: +1. Download git for Windows +2. Change the default OpenSSH shell to git bach with the following powershell command. +3. Set `tar_dereference` and `rm` variable to `true` in the YAML file +4. Avoid putting the `port` value through a variable +5. Convert the target path to a Unix path: `/c/path/to/target/` + +Change the default OpenSSH shell to git bach with the following powershell command. + ```powershell New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$env:Programfiles\Git\bin\bash.exe" -PropertyType String -Force ``` -3. Set `tar_dereference` and `rm` variable to `true` in the YAML file -4. Avoid putting the `port` value through a variable -5. Convert the target path to a Unix path: + +Convert the target path to a Unix path: `/c/path/to/target/` + ```diff - name: Copy to Windows uses: appleboy/scp-action@v0.1.4 @@ -333,4 +340,4 @@ New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$env: + target: '/c/path/to/target/' + tar_dereference: true + rm: true -``` +``` -- 2.54.0 From 3710327b67602586de2a7681d53fb1c009105c5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 22:51:58 +0800 Subject: [PATCH 27/69] chore(deps): bump tj-actions/changed-files from 36 to 37 (#129) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e622d8e..8e9e26a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v36 + uses: tj-actions/changed-files@v37 with: since_last_remote_commit: true separator: "," -- 2.54.0 From d398e64fcf9a236f9d7bba9daaa6863f34fd62ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Dec 2023 21:00:17 +0800 Subject: [PATCH 28/69] chore(deps): bump tj-actions/changed-files from 37 to 40 (#147) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 37 to 40. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v37...v40) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e9e26a..2383125 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,7 +123,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v37 + uses: tj-actions/changed-files@v40 with: since_last_remote_commit: true separator: "," -- 2.54.0 From b03ad1c1245f7387f6167907e7c012310a08c87f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Dec 2023 21:00:40 +0800 Subject: [PATCH 29/69] chore(deps): bump actions/checkout from 3 to 4 (#141) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2383125..327a53a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: copy file via ssh password uses: ./ @@ -90,7 +90,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: echo hello > world.txt @@ -119,7 +119,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get changed files id: changed-files @@ -143,7 +143,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: copy file to server uses: ./ @@ -160,7 +160,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: copy file to server uses: ./ -- 2.54.0 From abb6d70bee197f081d38ad12266d5d2fc0ecb0d0 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 25 Dec 2023 21:52:55 +0800 Subject: [PATCH 30/69] chore: update drone-scp to v1.6.12 version (#154) * chore: update Dockerfile and CI configuration - Remove unnecessary steps in the `testing` job in `ci.yml` - Update the base image in `Dockerfile` to version 1.6.12 - Change the location of the `entrypoint.sh` file in `Dockerfile` Signed-off-by: appleboy * update Signed-off-by: appleboy --------- Signed-off-by: appleboy --- .github/workflows/ci.yml | 243 ++++++++++++++++++--------------------- Dockerfile | 8 +- 2 files changed, 114 insertions(+), 137 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 327a53a..fc24ee6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,173 +1,150 @@ name: scp files on: [push] jobs: - testing: name: test scp action runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@v4 + - name: checkout + uses: actions/checkout@v4 - - name: copy file via ssh password - uses: ./ - 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 password + uses: ./ + 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: ./ - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - port: ${{ secrets.PORT }} - source: "tests/a.txt,tests/b.txt" - target: "test" + - name: copy file via ssh key + uses: ./ + 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: ./ - 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: remove the specified number of leading path elements + uses: ./ + 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: ./ - 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: ssh key with passphrase + uses: ./ + 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: ./ - 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 - - - name: correct key but wrong password - uses: appleboy/scp-action@7af00892de6f8397c5c3393cfb3b32ae7f91b94b - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - password: abcdefg - port: ${{ secrets.PORT }} - source: "tests/a.txt,tests/b.txt" - target: "test" - - - name: correct password but wrong key - uses: appleboy/scp-action@7af00892de6f8397c5c3393cfb3b32ae7f91b94b - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: abcdefg - password: ${{ secrets.PASSWORD }} - port: ${{ secrets.PORT }} - source: "tests/a.txt,tests/b.txt" - target: "test" + - name: use insecure cipher + uses: ./ + 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 + - name: checkout + uses: actions/checkout@v4 - - run: echo hello > world.txt + - run: echo hello > world.txt - - uses: actions/upload-artifact@v3 - with: - name: my-artifact - path: world.txt + - uses: actions/upload-artifact@v3 + with: + name: my-artifact + path: world.txt - - uses: actions/download-artifact@v3 - with: - name: my-artifact - path: distfiles + - uses: actions/download-artifact@v3 + with: + name: my-artifact + path: distfiles - - name: copy file to server - uses: ./ - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - port: ${{ secrets.PORT }} - source: distfiles/* - target: test + - name: copy file to server + uses: ./ + 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: checkout + uses: actions/checkout@v4 - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v40 - with: - since_last_remote_commit: true - separator: "," + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v37 + with: + since_last_remote_commit: true + separator: "," - - name: copy file to server - uses: ./ - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - port: ${{ secrets.PORT }} - source: ${{ steps.changed-files.outputs.all_changed_files }} - target: test + - name: copy file to server + uses: ./ + 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: checkout + uses: actions/checkout@v4 - - name: copy file to server - uses: ./ - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - port: ${{ secrets.PORT }} - source: tests/a.txt,tests/b.txt - target: foobar foobar 1234 + - name: copy file to server + uses: ./ + 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: checkout + uses: actions/checkout@v4 - - name: copy file to server - uses: ./ - 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 + - name: copy file to server + uses: ./ + 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 diff --git a/Dockerfile b/Dockerfile index e44e0f0..041b00d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM ghcr.io/appleboy/drone-scp:1.6.10 +FROM ghcr.io/appleboy/drone-scp:1.6.12 -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] +COPY entrypoint.sh /bin/entrypoint.sh + +ENTRYPOINT ["/bin/entrypoint.sh"] -- 2.54.0 From 5878fc908fe21ff5041828e0e01da8a0f89f18c5 Mon Sep 17 00:00:00 2001 From: appleboy Date: Mon, 25 Dec 2023 21:54:17 +0800 Subject: [PATCH 31/69] chore: update `appleboy/scp-action` to `v0.1.5` - Update the version of `appleboy/scp-action` from `v0.1.4` to `v0.1.5` Signed-off-by: appleboy --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2e38d9b..baf1315 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: copy file via ssh password - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -137,7 +137,7 @@ Copy file via a SSH password: ```yaml - name: copy file via ssh password - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: example.com username: foo @@ -151,7 +151,7 @@ Copy file via a SSH key: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -165,7 +165,7 @@ Example configuration for ignore list: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -178,7 +178,7 @@ Example configuration for ignore list: Example configuration for multiple servers: ```diff - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: - host: "example.com" + host: "foo.com,bar.com" @@ -192,7 +192,7 @@ Example configuration for multiple servers: Example configuration for exclude custom files: ```yaml - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: "example.com" username: foo @@ -226,7 +226,7 @@ Upload artifact files to remote server: path: distfiles - name: copy file to server - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -240,7 +240,7 @@ Remove the specified number of leading path elements: ```yaml - name: remove the specified number of leading path elements - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -286,7 +286,7 @@ Only copy files that are newer than the corresponding destination files: separator: "," - name: copy file to server - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -300,7 +300,7 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th ```diff - name: ssh key with passphrase - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -329,7 +329,7 @@ Convert the target path to a Unix path: `/c/path/to/target/` ```diff - name: Copy to Windows - uses: appleboy/scp-action@v0.1.4 + uses: appleboy/scp-action@v0.1.5 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} -- 2.54.0 From 950981a11dcd98c334bfa28af4a0c137330159be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 10:39:54 +0800 Subject: [PATCH 32/69] chore(deps): bump actions/download-artifact from 3 to 4 (#155) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc24ee6..302b0db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: name: my-artifact path: world.txt - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: my-artifact path: distfiles -- 2.54.0 From aef31a66e3464b0efa2182991c282b85d6fd48c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 10:40:20 +0800 Subject: [PATCH 33/69] chore(deps): bump actions/upload-artifact from 3 to 4 (#157) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 302b0db..cc4049d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: - run: echo hello > world.txt - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: my-artifact path: world.txt -- 2.54.0 From 96947ea2bd19d669b7194d88f1cc0deddd1e35bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 10:40:41 +0800 Subject: [PATCH 34/69] chore(deps): bump tj-actions/changed-files from 37 to 41 (#156) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 37 to 41. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v37...v41) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc4049d..b8456d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v37 + uses: tj-actions/changed-files@v41 with: since_last_remote_commit: true separator: "," -- 2.54.0 From 35093a99f9d2c59e93c23c21453ed7bf0bfc81b2 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 26 Dec 2023 13:54:08 +0800 Subject: [PATCH 35/69] chore: update drone-scp image to v1.6.13 (#158) - Update the drone-scp image from version `1.6.12` to `1.6.13` in the Dockerfile Signed-off-by: Bo-Yi Wu --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 041b00d..435d1c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/appleboy/drone-scp:1.6.12 +FROM ghcr.io/appleboy/drone-scp:1.6.13 COPY entrypoint.sh /bin/entrypoint.sh -- 2.54.0 From dfde1f50eb43f4d56f88001defa009a8ecc94853 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 26 Dec 2023 14:48:33 +0800 Subject: [PATCH 36/69] chore: refine CI/CD workflows and tests configuration - Update `appleboy/scp-action` version from `v0.1.5` to `v0.1.6` in README examples Signed-off-by: Bo-Yi Wu --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index baf1315..3dd95a8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: copy file via ssh password - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -137,7 +137,7 @@ Copy file via a SSH password: ```yaml - name: copy file via ssh password - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: example.com username: foo @@ -151,7 +151,7 @@ Copy file via a SSH key: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -165,7 +165,7 @@ Example configuration for ignore list: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -178,7 +178,7 @@ Example configuration for ignore list: Example configuration for multiple servers: ```diff - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: - host: "example.com" + host: "foo.com,bar.com" @@ -192,7 +192,7 @@ Example configuration for multiple servers: Example configuration for exclude custom files: ```yaml - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: "example.com" username: foo @@ -226,7 +226,7 @@ Upload artifact files to remote server: path: distfiles - name: copy file to server - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -240,7 +240,7 @@ Remove the specified number of leading path elements: ```yaml - name: remove the specified number of leading path elements - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -286,7 +286,7 @@ Only copy files that are newer than the corresponding destination files: separator: "," - name: copy file to server - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -300,7 +300,7 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th ```diff - name: ssh key with passphrase - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -329,7 +329,7 @@ Convert the target path to a Unix path: `/c/path/to/target/` ```diff - name: Copy to Windows - uses: appleboy/scp-action@v0.1.5 + uses: appleboy/scp-action@v0.1.6 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} -- 2.54.0 From 78e7f475f3d290ca634646492a11b45560541455 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 1 Jan 2024 13:44:54 +0800 Subject: [PATCH 37/69] chore: update base image in Dockerfile to version 1.6.14 - Update the base image from `1.6.13` to `1.6.14` in the Dockerfile Signed-off-by: Bo-Yi Wu --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 435d1c5..f7a67f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/appleboy/drone-scp:1.6.13 +FROM ghcr.io/appleboy/drone-scp:1.6.14 COPY entrypoint.sh /bin/entrypoint.sh -- 2.54.0 From 917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 1 Jan 2024 13:45:26 +0800 Subject: [PATCH 38/69] chore: update dependencies and improve compatibility with latest versions - Update the version of `appleboy/scp-action` from `v0.1.6` to `v0.1.7` Signed-off-by: Bo-Yi Wu --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3dd95a8..0a4297e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: copy file via ssh password - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -137,7 +137,7 @@ Copy file via a SSH password: ```yaml - name: copy file via ssh password - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: example.com username: foo @@ -151,7 +151,7 @@ Copy file via a SSH key: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -165,7 +165,7 @@ Example configuration for ignore list: ```yaml - name: copy file via ssh key - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -178,7 +178,7 @@ Example configuration for ignore list: Example configuration for multiple servers: ```diff - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: - host: "example.com" + host: "foo.com,bar.com" @@ -192,7 +192,7 @@ Example configuration for multiple servers: Example configuration for exclude custom files: ```yaml - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: "example.com" username: foo @@ -226,7 +226,7 @@ Upload artifact files to remote server: path: distfiles - name: copy file to server - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -240,7 +240,7 @@ Remove the specified number of leading path elements: ```yaml - name: remove the specified number of leading path elements - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -286,7 +286,7 @@ Only copy files that are newer than the corresponding destination files: separator: "," - name: copy file to server - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -300,7 +300,7 @@ Protecting a Private Key. The purpose of the passphrase is usually to encrypt th ```diff - name: ssh key with passphrase - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -329,7 +329,7 @@ Convert the target path to a Unix path: `/c/path/to/target/` ```diff - name: Copy to Windows - uses: appleboy/scp-action@v0.1.6 + uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} -- 2.54.0 From 9f34cc3e55716193b68f260db14c300d100e25f2 Mon Sep 17 00:00:00 2001 From: Ilya Brin <464157+ilyabrin@users.noreply.github.com> Date: Mon, 1 Jan 2024 08:46:55 +0300 Subject: [PATCH 39/69] docs(readme): update dependency in example (#159) Bumped GitHub Actions in README --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0a4297e..eec6d6b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: copy file via ssh password uses: appleboy/scp-action@v0.1.7 with: @@ -211,16 +211,16 @@ Upload artifact files to remote server: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: echo hello > world.txt - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: my-artifact path: world.txt - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: my-artifact path: distfiles @@ -276,7 +276,7 @@ Only copy files that are newer than the corresponding destination files: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get changed files id: changed-files -- 2.54.0 From 699fa1181c488c41b46d1a3b4f36d165c67c71d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 27 Jan 2024 11:08:08 +0800 Subject: [PATCH 40/69] chore(deps): bump tj-actions/changed-files from 41 to 42 (#165) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 41 to 42. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v41...v42) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8456d9..8687582 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v41 + uses: tj-actions/changed-files@v42 with: since_last_remote_commit: true separator: "," -- 2.54.0 From f314a5399e8cd139438868bd604049643badc458 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 09:42:58 +0800 Subject: [PATCH 41/69] chore(deps): bump tj-actions/changed-files from 42 to 43 (#170) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 42 to 43. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v42...v43) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8687582..6c045c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v42 + uses: tj-actions/changed-files@v43 with: since_last_remote_commit: true separator: "," -- 2.54.0 From 9ba62064d28ce0897a970e72cdfe30b9fde2fe48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 6 Apr 2024 08:11:24 +0800 Subject: [PATCH 42/69] chore(deps): bump tj-actions/changed-files from 43 to 44 (#171) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 43 to 44. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v43...v44) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c045c0..35f435c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v43 + uses: tj-actions/changed-files@v44 with: since_last_remote_commit: true separator: "," -- 2.54.0 From 7622c01418bb85cb0b93dc636050db7d64f90245 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 27 Aug 2024 21:02:52 +0800 Subject: [PATCH 43/69] chore: update tj-actions/changed-files action version - Update the version of the `tj-actions/changed-files` action from `v44` to `v46` Signed-off-by: Bo-Yi Wu --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35f435c..e4c7069 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v44 + uses: tj-actions/changed-files@v46 with: since_last_remote_commit: true separator: "," -- 2.54.0 From c6ff96b7f6d4941429ff4b6aa5b9b0e1c7ff38ea Mon Sep 17 00:00:00 2001 From: appleboy Date: Mon, 7 Oct 2024 22:41:36 +0800 Subject: [PATCH 44/69] ci: implement automated release workflow with GoReleaser - Add GitHub Actions workflow for GoReleaser - Configure GoReleaser to skip builds - Set up changelog groups for features, bug fixes, enhancements, refactors, build process updates, and documentation updates Signed-off-by: appleboy --- .github/workflows/goreleaser.yml | 33 ++++++++++++++++++++++++++++++++ .goreleaser.yaml | 28 +++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/goreleaser.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..7f1ae24 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,33 @@ +name: Goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version: "^1" + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..01b1081 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,28 @@ +builds: + - # If true, skip the build. + # Useful for library projects. + # Default is false + skip: true + +changelog: + use: github + groups: + - title: Features + regexp: "^.*feat[(\\w)]*:+.*$" + order: 0 + - title: "Bug fixes" + regexp: "^.*fix[(\\w)]*:+.*$" + order: 1 + - title: "Enhancements" + regexp: "^.*chore[(\\w)]*:+.*$" + order: 2 + - title: "Refactor" + regexp: "^.*refactor[(\\w)]*:+.*$" + order: 3 + - title: "Build process updates" + regexp: ^.*?(build|ci)(\(.+\))??!?:.+$ + order: 4 + - title: "Documentation updates" + regexp: ^.*?docs?(\(.+\))??!?:.+$ + order: 4 + - title: Others -- 2.54.0 From 93e17a47f90c431216b99107bc5f77e74b0fe92a Mon Sep 17 00:00:00 2001 From: appleboy Date: Mon, 28 Oct 2024 22:28:31 +0800 Subject: [PATCH 45/69] refactor(actions): standardize configuration file formatting and defaults - Change single quotes to double quotes for consistency in `name`, `description`, and `author` fields - Update `port` and `proxy_port` default values to be strings instead of numbers - Remove default values for `use_insecure_cipher`, `rm`, `debug`, `strip_components`, `overwrite`, and `tar_dereference` fields - Add default value `"tar"` for `tar_exec` field Signed-off-by: appleboy --- action.yml | 87 +++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/action.yml b/action.yml index a322c3d..f167d81 100644 --- a/action.yml +++ b/action.yml @@ -1,84 +1,77 @@ -name: 'SCP Command to Transfer Files' -description: 'How to Use SCP Command to Transfer Files/Folders in Linux' -author: 'Bo-Yi Wu' +name: "SCP Command to Transfer Files" +description: "How to Use SCP Command to Transfer Files/Folders in Linux" +author: "Bo-Yi Wu" inputs: host: - description: 'scp remote host' + description: "scp remote host" port: - description: 'scp remote port' - default: 22 + description: "scp remote port" + default: "22" username: - description: 'scp username' + description: "scp username" password: - description: 'scp password' + description: "scp password" timeout: - description: 'timeout for ssh to remote host' + description: "timeout for ssh to remote host" default: "30s" command_timeout: - description: 'timeout for scp command' + description: "timeout for scp command" default: "10m" key: - description: 'content of ssh private key. ex raw content of ~/.ssh/id_rsa' + description: "content of ssh private key. ex raw content of ~/.ssh/id_rsa" key_path: - description: 'path of ssh private key' + description: "path of ssh private key" passphrase: - description: 'ssh key passphrase' + description: "ssh key passphrase" fingerprint: - description: 'fingerprint SHA256 of the host public key, default is to skip verification' + description: "fingerprint SHA256 of the host public key, default is to skip verification" use_insecure_cipher: - description: 'include more ciphers with use_insecure_cipher' - default: false + description: "include more ciphers with use_insecure_cipher" target: - description: 'target path on the server, must be a directory path.' + description: "target path on the server, must be a directory path." source: - description: 'scp file list' + description: "scp file list" rm: - description: 'remove target folder before upload data' - default: false + description: "remove target folder before upload data" debug: - description: 'enable debug message' - default: false + description: "enable debug message" strip_components: - description: 'remove the specified number of leading path elements' - default: 0 + description: "remove the specified number of leading path elements" overwrite: - description: 'use --overwrite flag with tar' - default: false + description: "use --overwrite flag with tar" tar_dereference: - description: 'use --dereference flag with tar' - default: false + description: "use --dereference flag with tar" tar_tmp_path: - description: 'temporary path for tar file on the dest host' + description: "temporary path for tar file on the dest host" tar_exec: - description: 'temporary path for tar file on the dest host' - default: 'tar' + description: "temporary path for tar file on the dest host" + default: "tar" proxy_host: - description: 'ssh proxy remote host' + description: "ssh proxy remote host" proxy_port: - description: 'ssh proxy remote port' - default: 22 + description: "ssh proxy remote port" + default: "22" proxy_username: - description: 'ssh proxy username' + description: "ssh proxy username" proxy_password: - description: 'ssh proxy password' + description: "ssh proxy password" proxy_passphrase: - description: 'ssh proxy key passphrase' + description: "ssh proxy key passphrase" proxy_timeout: - description: 'timeout for ssh to proxy host' + description: "timeout for ssh to proxy host" default: "30s" proxy_key: - description: 'content of ssh proxy private key. ex raw content of ~/.ssh/id_rsa' + description: "content of ssh proxy private key. ex raw content of ~/.ssh/id_rsa" proxy_key_path: - description: 'path of ssh proxy private key' + description: "path of ssh proxy private key" proxy_fingerprint: - description: 'fingerprint SHA256 of the host public key, default is to skip verification' + description: "fingerprint SHA256 of the host public key, default is to skip verification" proxy_use_insecure_cipher: - description: 'include more ciphers with use_insecure_cipher' - default: false + description: "include more ciphers with use_insecure_cipher" runs: - using: 'docker' - image: 'Dockerfile' + using: "docker" + image: "Dockerfile" branding: - icon: 'copy' - color: 'gray-dark' + icon: "copy" + color: "gray-dark" -- 2.54.0 From 172d4632fe427b3e7d9120e1d98ef5e79c2925f7 Mon Sep 17 00:00:00 2001 From: appleboy Date: Mon, 28 Oct 2024 22:33:53 +0800 Subject: [PATCH 46/69] feat(actions): improve API robustness and testing coverage - Add `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 f167d81..2e658ca 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,9 @@ inputs: description: "scp username" password: description: "scp password" + protocol: + description: "The IP protocol to use. Valid values are 'tcp'. 'tcp4' or 'tcp6'. Default to tcp." + default: "tcp" timeout: description: "timeout for ssh to remote host" default: "30s" -- 2.54.0 From ad9a378b7f4bbcd1987e09397c03ce91e770d162 Mon Sep 17 00:00:00 2001 From: appleboy Date: Mon, 28 Oct 2024 22:38:25 +0800 Subject: [PATCH 47/69] docs(readme): enhance IP protocol configuration options - Add protocol option description for IP protocol usage in the main configuration - Add proxy_protocol option description for IP protocol usage in the SSH Proxy Setting Signed-off-by: appleboy --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index eec6d6b..b510a2d 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ See the [action.yml](./action.yml) file for more detail information. * username - scp username * password - scp password * passphrase - the passphrase is usually to encrypt the private key +* protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. * fingerprint - fingerprint SHA256 of the host public key, default is to skip verification * timeout - timeout for ssh to remote host, default is `30s` * command_timeout - timeout for scp command, default is `10m` @@ -61,6 +62,7 @@ SSH Proxy Setting: * proxy_port - proxy port, default is `22` * proxy_username - proxy username * proxy_password - proxy password +* proxy_protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. * proxy_passphrase - the passphrase is usually to encrypt the private key * proxy_timeout - timeout for ssh to proxy host, default is `30s` * proxy_key - content of ssh proxy private key. -- 2.54.0 From f042d742db5dd7c2fc7e588f36cf0558cd921638 Mon Sep 17 00:00:00 2001 From: appleboy Date: Tue, 29 Oct 2024 21:22:29 +0800 Subject: [PATCH 48/69] ci(github): improve system performance and stability - Downgrade `tj-actions/changed-files` action from version `v46` to `v45` Signed-off-by: appleboy --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4c7069..fb616d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v46 + uses: tj-actions/changed-files@v45 with: since_last_remote_commit: true separator: "," -- 2.54.0 From b03d7257ae96fb1a5a3bacd3ce6836de20d71593 Mon Sep 17 00:00:00 2001 From: appleboy Date: Tue, 24 Dec 2024 22:05:54 +0800 Subject: [PATCH 49/69] style: improve readability and functionality across multiple components - Remove an empty line in the jobs section - Reformat the list of SCP options for better readability - Reformat the list of SSH proxy settings for better readability - Reformat the instructions for SSH login without a password for better readability Signed-off-by: appleboy --- README.md | 105 +++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index b510a2d..2d9b55c 100644 --- a/README.md +++ b/README.md @@ -14,61 +14,60 @@ Copy files and artifacts via SSH: name: scp files on: [push] jobs: - build: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: copy file via ssh password - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - port: ${{ secrets.PORT }} - source: "tests/a.txt,tests/b.txt" - target: your_server_target_folder_path + - uses: actions/checkout@v4 + - name: copy file via ssh password + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: your_server_target_folder_path ``` ## Input variables See the [action.yml](./action.yml) file for more detail information. -* host - scp remote host -* port - scp remote port, default is `22` -* username - scp username -* password - scp password -* passphrase - the passphrase is usually to encrypt the private key -* protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. -* fingerprint - fingerprint SHA256 of the host public key, default is to skip verification -* timeout - timeout for ssh to remote host, default is `30s` -* command_timeout - timeout for scp command, default is `10m` -* key - content of ssh private key. ex raw content of ~/.ssh/id_rsa -* key_path - path of ssh private key -* target - target path on the server, must be a directory (**required**) -* source - scp file list (**required**) -* rm - remove target folder before upload data, default is `false` -* strip_components - remove the specified number of leading path elements. -* overwrite - use `--overwrite` flag with tar, overwrite existing files when extracting -* tar_tmp_path - temporary path for tar file on the dest host -* tar_exec - path to tar executable on the dest host. default is `tar` -* tar_dereference - use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to -* use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) +- host - scp remote host +- port - scp remote port, default is `22` +- username - scp username +- password - scp password +- passphrase - the passphrase is usually to encrypt the private key +- protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. +- fingerprint - fingerprint SHA256 of the host public key, default is to skip verification +- timeout - timeout for ssh to remote host, default is `30s` +- command_timeout - timeout for scp command, default is `10m` +- key - content of ssh private key. ex raw content of ~/.ssh/id_rsa +- key_path - path of ssh private key +- target - target path on the server, must be a directory (**required**) +- source - scp file list (**required**) +- rm - remove target folder before upload data, default is `false` +- strip_components - remove the specified number of leading path elements. +- overwrite - use `--overwrite` flag with tar, overwrite existing files when extracting +- tar_tmp_path - temporary path for tar file on the dest host +- tar_exec - path to tar executable on the dest host. default is `tar` +- tar_dereference - use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to +- use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) SSH Proxy Setting: -* proxy_host - proxy host -* proxy_port - proxy port, default is `22` -* proxy_username - proxy username -* proxy_password - proxy password -* proxy_protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. -* proxy_passphrase - the passphrase is usually to encrypt the private key -* proxy_timeout - timeout for ssh to proxy host, default is `30s` -* proxy_key - content of ssh proxy private key. -* proxy_key_path - path of ssh proxy private key -* proxy_fingerprint - fingerprint SHA256 of the host public key, default is to skip verification -* proxy_use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) +- proxy_host - proxy host +- proxy_port - proxy port, default is `22` +- proxy_username - proxy username +- proxy_password - proxy password +- proxy_protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. +- proxy_passphrase - the passphrase is usually to encrypt the private key +- proxy_timeout - timeout for ssh to proxy host, default is `30s` +- proxy_key - content of ssh proxy private key. +- proxy_key_path - path of ssh proxy private key +- proxy_fingerprint - fingerprint SHA256 of the host public key, default is to skip verification +- proxy_use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) ## Setting up a SSH Key @@ -108,9 +107,9 @@ See the detail information about [SSH login without password](http://www.linuxpr **A note** from one of our readers: Depending on your version of SSH you might also have to do the following changes: -* Put the public key in `.ssh/authorized_keys2` -* Change the permissions of `.ssh` to 700 -* Change the permissions of `.ssh/authorized_keys2` to 640 +- Put the public key in `.ssh/authorized_keys2` +- Change the permissions of `.ssh` to 700 +- Change the permissions of `.ssh/authorized_keys2` to 640 ### If you are using OpenSSH @@ -208,10 +207,10 @@ Example configuration for exclude custom files: Upload artifact files to remote server: ```yaml - deploy: - name: deploy artifact - runs-on: ubuntu-latest - steps: +deploy: + name: deploy artifact + runs-on: ubuntu-latest + steps: - name: checkout uses: actions/checkout@v4 @@ -273,10 +272,10 @@ foobar Only copy files that are newer than the corresponding destination files: ```yaml - changes: - name: test changed-files - runs-on: ubuntu-latest - steps: +changes: + name: test changed-files + runs-on: ubuntu-latest + steps: - name: checkout uses: actions/checkout@v4 -- 2.54.0 From 4f2c27bbc2b4ea0d65964cd9793b05fa593a340f Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 24 Dec 2024 22:09:30 +0800 Subject: [PATCH 50/69] docs: improve documentation and testing configurations (#193) - Add example for using environment variables with `scp-action` in README.md Signed-off-by: appleboy --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 2d9b55c..42c74e6 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,20 @@ Copy file via a SSH password: target: your_server_target_folder_path ``` +Using the environment variables + +```yaml +- name: copy file via ssh password + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ env.HOST }} + username: ${{ env.USERNAME }} + password: ${{ secrets.PASSWORD }} + port: ${{ env.PORT }} + source: "tests/a.txt,tests/b.txt" + target: ${{ env.TARGET_PATH }} +``` + Copy file via a SSH key: ```yaml -- 2.54.0 From 2a829c0ed2e300ffdab24dc6c26998da3ddc8025 Mon Sep 17 00:00:00 2001 From: appleboy Date: Tue, 24 Dec 2024 22:15:15 +0800 Subject: [PATCH 51/69] docs: improve API performance and update documentation - Fix grammar in README to clarify Linux Docker container support Signed-off-by: appleboy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42c74e6..ed14599 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) -**Important**: Only support **Linux** [docker](https://www.docker.com/) container. +**Important**: Only supports **Linux** [docker](https://www.docker.com/) containers. ## Usage -- 2.54.0 From 3d59448764c0f94f80ffcfea943710c44b75cb43 Mon Sep 17 00:00:00 2001 From: appleboy Date: Wed, 25 Dec 2024 09:04:14 +0800 Subject: [PATCH 52/69] docs: enhance SSH configuration documentation and testing - Replace detailed SCP and SSH proxy settings with a table format for better readability - Improve clarity and grammar in instructions for creating and using SSH keys Signed-off-by: appleboy --- README.md | 72 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index ed14599..b08c715 100644 --- a/README.md +++ b/README.md @@ -34,46 +34,50 @@ jobs: See the [action.yml](./action.yml) file for more detail information. -- host - scp remote host -- port - scp remote port, default is `22` -- username - scp username -- password - scp password -- passphrase - the passphrase is usually to encrypt the private key -- protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. -- fingerprint - fingerprint SHA256 of the host public key, default is to skip verification -- timeout - timeout for ssh to remote host, default is `30s` -- command_timeout - timeout for scp command, default is `10m` -- key - content of ssh private key. ex raw content of ~/.ssh/id_rsa -- key_path - path of ssh private key -- target - target path on the server, must be a directory (**required**) -- source - scp file list (**required**) -- rm - remove target folder before upload data, default is `false` -- strip_components - remove the specified number of leading path elements. -- overwrite - use `--overwrite` flag with tar, overwrite existing files when extracting -- tar_tmp_path - temporary path for tar file on the dest host -- tar_exec - path to tar executable on the dest host. default is `tar` -- tar_dereference - use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to -- use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) +| Variable | Description | Default Value | +| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------- | +| host | SCP remote host | - | +| port | SCP remote port | `22` | +| username | SCP username | - | +| password | SCP password | - | +| passphrase | The passphrase is usually used to encrypt the private key | - | +| protocol | The IP protocol to use. Valid values are `tcp`, `tcp4`, or `tcp6`. | `tcp` | +| fingerprint | Fingerprint SHA256 of the host public key. Default is to skip verification | - | +| timeout | Timeout for SSH to remote host | `30s` | +| command_timeout | Timeout for SCP command | `10m` | +| key | Content of SSH private key. e.g., raw content of ~/.ssh/id_rsa | - | +| key_path | Path of SSH private key | - | +| target | Target path on the server, must be a directory (**required**) | - | +| source | SCP file list (**required**) | - | +| rm | Remove target folder before uploading data | `false` | +| strip_components | Remove the specified number of leading path elements | - | +| overwrite | Use `--overwrite` flag with tar, overwrite existing files when extracting | - | +| tar_tmp_path | Temporary path for tar file on the destination host | - | +| tar_exec | Path to tar executable on the destination host | `tar` | +| tar_dereference | Use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to | - | +| use_insecure_cipher | Include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) | - | SSH Proxy Setting: -- proxy_host - proxy host -- proxy_port - proxy port, default is `22` -- proxy_username - proxy username -- proxy_password - proxy password -- proxy_protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`. -- proxy_passphrase - the passphrase is usually to encrypt the private key -- proxy_timeout - timeout for ssh to proxy host, default is `30s` -- proxy_key - content of ssh proxy private key. -- proxy_key_path - path of ssh proxy private key -- proxy_fingerprint - fingerprint SHA256 of the host public key, default is to skip verification -- proxy_use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) +| Variable | Description | Default Value | +| ------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------- | +| proxy_host | Proxy host | - | +| proxy_port | Proxy port | `22` | +| proxy_username | Proxy username | - | +| proxy_password | Proxy password | - | +| proxy_protocol | The IP protocol to use. Valid values are `tcp`, `tcp4`, or `tcp6`. | `tcp` | +| proxy_passphrase | The passphrase is usually used to encrypt the private key | - | +| proxy_timeout | Timeout for SSH to proxy host | `30s` | +| proxy_key | Content of SSH proxy private key | - | +| proxy_key_path | Path of SSH proxy private key | - | +| proxy_fingerprint | Fingerprint SHA256 of the host public key. Default is to skip verification | - | +| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) | - | ## Setting up a SSH Key -Make sure to follow the below steps while creating SSH Keys and using them. -The best practice is create the SSH Keys on local machine not remote machine. -Login with username specified in Github Secrets. Generate a RSA Key-Pair: +Make sure to follow the steps below when creating and using SSH keys. +The best practice is to create the SSH keys on the local machine, not the remote machine. +Log in with the username specified in GitHub Secrets and generate an RSA key pair: ```bash # rsa -- 2.54.0 From 98b7132065988dbffe4b543a609f3483ea3cf261 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 27 Apr 2025 10:38:00 +0800 Subject: [PATCH 53/69] feat: migrate to composite action with dynamic drone-scp support (#197) - Remove Dockerfile and switch the action implementation from Docker to composite actions - Add support for specifying the drone-scp version and automatically download the appropriate binary at runtime - Add new inputs: curl_insecure, capture_stdout, and version for improved flexibility and output handling - Add output for capturing standard output from executed commands when enabled - entrypoint.sh refactored from sh to bash and made more robust with error handling, dynamic platform/architecture detection, and secure downloading of the binary - Action now works cross-platform rather than being tied to a specific Docker image Signed-off-by: appleboy --- Dockerfile | 5 ---- action.yml | 66 +++++++++++++++++++++++++++++++++++++++++++++++++-- entrypoint.sh | 57 ++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 117 insertions(+), 11 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index f7a67f7..0000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ghcr.io/appleboy/drone-scp:1.6.14 - -COPY entrypoint.sh /bin/entrypoint.sh - -ENTRYPOINT ["/bin/entrypoint.sh"] diff --git a/action.yml b/action.yml index 2e658ca..455583d 100644 --- a/action.yml +++ b/action.yml @@ -71,9 +71,71 @@ inputs: description: "fingerprint SHA256 of the host public key, default is to skip verification" proxy_use_insecure_cipher: description: "include more ciphers with use_insecure_cipher" + curl_insecure: + description: "When true, uses the --insecure option with curl for insecure downloads." + default: "false" + capture_stdout: + description: "When true, captures and returns standard output from the commands as action output." + default: "false" + version: + description: | + The version of drone-scp to use. + +outputs: + stdout: + description: "Standard output of the executed commands when capture_stdout is enabled." + value: ${{ steps.entrypoint.outputs.stdout }} + runs: - using: "docker" - image: "Dockerfile" + using: "composite" + steps: + - name: Set GitHub Path + run: echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH + shell: bash + env: + GITHUB_ACTION_PATH: ${{ github.action_path }} + - id: entrypoint + name: Run entrypoint.sh + run: entrypoint.sh + shell: bash + env: + GITHUB_ACTION_PATH: ${{ github.action_path }} + INPUT_HOST: ${{ inputs.host }} + INPUT_PORT: ${{ inputs.port }} + INPUT_PROTOCOL: ${{ inputs.protocol }} + INPUT_USERNAME: ${{ inputs.username }} + INPUT_PASSWORD: ${{ inputs.password }} + INPUT_PASSPHRASE: ${{ inputs.passphrase }} + INPUT_KEY: ${{ inputs.key }} + INPUT_KEY_PATH: ${{ inputs.key_path }} + INPUT_FINGERPRINT: ${{ inputs.fingerprint }} + INPUT_PROXY_HOST: ${{ inputs.proxy_host }} + INPUT_PROXY_PORT: ${{ inputs.proxy_port }} + INPUT_PROXY_USERNAME: ${{ inputs.proxy_username }} + INPUT_PROXY_PASSWORD: ${{ inputs.proxy_password }} + INPUT_PROXY_PASSPHRASE: ${{ inputs.proxy_passphrase }} + INPUT_PROXY_KEY: ${{ inputs.proxy_key }} + INPUT_PROXY_KEY_PATH: ${{ inputs.proxy_key_path }} + INPUT_PROXY_FINGERPRINT: ${{ inputs.proxy_fingerprint }} + INPUT_USE_INSECURE_CIPHER: ${{ inputs.use_insecure_cipher }} + INPUT_CIPHER: ${{ inputs.cipher }} + INPUT_PROXY_USE_INSECURE_CIPHER: ${{ inputs.proxy_use_insecure_cipher }} + INPUT_PROXY_CIPHER: ${{ inputs.proxy_cipher }} + INPUT_DEBUG: ${{ inputs.debug }} + INPUT_TIMEOUT: ${{ inputs.timeout }} + INPUT_COMMAND_TIMEOUT: ${{ inputs.command_timeout }} + INPUT_TARGET: ${{ inputs.target }} + INPUT_SOURCE: ${{ inputs.source }} + INPUT_RM: ${{ inputs.rm }} + INPUT_STRIP_COMPONENTS: ${{ inputs.strip_components }} + INPUT_OVERWRITE: ${{ inputs.overwrite }} + INPUT_TAR_DEREFERENCE: ${{ inputs.tar_dereference }} + INPUT_TAR_TMP_PATH: ${{ inputs.tar_tmp_path }} + INPUT_TAR_EXEC: ${{ inputs.tar_exec }} + INPUT_PROXY_TIMEOUT: ${{ inputs.proxy_timeout }} + INPUT_CAPTURE_STDOUT: ${{ inputs.capture_stdout }} + INPUT_CURL_INSECURE: ${{ inputs.curl_insecure }} + DRONE_SCP_VERSION: ${{ inputs.version }} branding: icon: "copy" diff --git a/entrypoint.sh b/entrypoint.sh index 178bcee..bde81cd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,56 @@ -#!/bin/sh +#!/usr/bin/env bash -set -eu +set -euo pipefail -[ -n "$INPUT_STRIP_COMPONENTS" ] && export INPUT_STRIP_COMPONENTS=$((INPUT_STRIP_COMPONENTS + 0)) +export GITHUB="true" -sh -c "/bin/drone-scp $*" +GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}" +DRONE_SCP_RELEASE_URL="${DRONE_SCP_RELEASE_URL:-https://github.com/appleboy/drone-scp/releases/download}" +DRONE_SCP_VERSION="${DRONE_SCP_VERSION:-1.7.0}" + +function log_error() { + echo "$1" >&2 + exit "$2" +} + +function detect_client_info() { + CLIENT_PLATFORM="${SCP_CLIENT_OS:-$(uname -s | tr '[:upper:]' '[:lower:]')}" + CLIENT_ARCH="${SCP_CLIENT_ARCH:-$(uname -m)}" + + case "${CLIENT_PLATFORM}" in + darwin | linux | windows) ;; + *) log_error "Unknown or unsupported platform: ${CLIENT_PLATFORM}. Supported platforms are Linux, Darwin, and Windows." 2 ;; + esac + + case "${CLIENT_ARCH}" in + x86_64* | i?86_64* | amd64*) CLIENT_ARCH="amd64" ;; + aarch64* | arm64*) CLIENT_ARCH="arm64" ;; + *) log_error "Unknown or unsupported architecture: ${CLIENT_ARCH}. Supported architectures are x86_64, i686, and arm64." 3 ;; + esac +} + +detect_client_info +DOWNLOAD_URL_PREFIX="${DRONE_SCP_RELEASE_URL}/v${DRONE_SCP_VERSION}" +CLIENT_BINARY="drone-scp-${DRONE_SCP_VERSION}-${CLIENT_PLATFORM}-${CLIENT_ARCH}" +TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}" +echo "Downloading ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}" +INSECURE_OPTION="" +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}" + +echo "======= CLI Version Information =======" +"${TARGET}" --version +echo "=======================================" +if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then + { + echo 'stdout<>"${GITHUB_OUTPUT}" +else + "${TARGET}" "$@" +fi -- 2.54.0 From bc835cba55a1d2660060d9dedbc560a0aa23a444 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 11:15:08 +0800 Subject: [PATCH 54/69] docs: refine input descriptions for clarity and user guidance - Improve and clarify input descriptions for better usability and understanding - Add guidance on defaults, security considerations, and example values in several input descriptions - Reword descriptions to be more user-friendly and precise throughout configuration Signed-off-by: appleboy --- action.yml | 64 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/action.yml b/action.yml index 455583d..e523cb6 100644 --- a/action.yml +++ b/action.yml @@ -1,76 +1,76 @@ name: "SCP Command to Transfer Files" -description: "How to Use SCP Command to Transfer Files/Folders in Linux" +description: "Easily transfer files and folders using the SCP command in Linux." author: "Bo-Yi Wu" inputs: host: - description: "scp remote host" + description: "Remote host address for SCP (e.g., example.com or 192.168.1.1)." port: - description: "scp remote port" + description: "Remote SSH port for SCP. Default: 22." default: "22" username: - description: "scp username" + description: "Username for SSH authentication." password: - description: "scp password" + description: "Password for SSH authentication (not recommended; use SSH keys if possible)." protocol: - description: "The IP protocol to use. Valid values are 'tcp'. 'tcp4' or 'tcp6'. Default to tcp." + description: "IP protocol to use. Valid values: 'tcp', 'tcp4', or 'tcp6'. Default: tcp." default: "tcp" timeout: - description: "timeout for ssh to remote host" + description: "Timeout for establishing SSH connection to the remote host. Default: 30s." default: "30s" command_timeout: - description: "timeout for scp command" + description: "Timeout for the SCP command execution. Default: 10m." default: "10m" key: - description: "content of ssh private key. ex raw content of ~/.ssh/id_rsa" + description: "Content of the SSH private key (e.g., the raw content of ~/.ssh/id_rsa)." key_path: - description: "path of ssh private key" + description: "Path to the SSH private key file." passphrase: - description: "ssh key passphrase" + description: "Passphrase for the SSH private key, if required." fingerprint: - description: "fingerprint SHA256 of the host public key, default is to skip verification" + description: "SHA256 fingerprint of the host's public key. If not set, host key verification is skipped (not recommended for production)." use_insecure_cipher: - description: "include more ciphers with use_insecure_cipher" + description: "Enable additional, less secure ciphers for compatibility. Not recommended unless required." target: - description: "target path on the server, must be a directory path." + description: "Target directory path on the remote server. Must be a directory." source: - description: "scp file list" + description: "List of files or directories to transfer (local paths)." rm: - description: "remove target folder before upload data" + description: "Remove the target directory on the server before uploading new data." debug: - description: "enable debug message" + description: "Enable debug messages for troubleshooting." strip_components: - description: "remove the specified number of leading path elements" + description: "Remove the specified number of leading path elements when extracting files." overwrite: - description: "use --overwrite flag with tar" + description: "Use the --overwrite flag with tar to overwrite existing files." tar_dereference: - description: "use --dereference flag with tar" + description: "Use the --dereference flag with tar to follow symlinks." tar_tmp_path: - description: "temporary path for tar file on the dest host" + description: "Temporary path for the tar file on the destination host." tar_exec: - description: "temporary path for tar file on the dest host" + description: "Path to the tar executable on the destination host. Default: tar." default: "tar" proxy_host: - description: "ssh proxy remote host" + description: "Remote host address for SSH proxy." proxy_port: - description: "ssh proxy remote port" + description: "SSH proxy port. Default: 22." default: "22" proxy_username: - description: "ssh proxy username" + description: "Username for SSH proxy authentication." proxy_password: - description: "ssh proxy password" + description: "Password for SSH proxy authentication." proxy_passphrase: - description: "ssh proxy key passphrase" + description: "Passphrase for the SSH proxy private key, if required." proxy_timeout: - description: "timeout for ssh to proxy host" + description: "Timeout for establishing SSH connection to the proxy host. Default: 30s." default: "30s" proxy_key: - description: "content of ssh proxy private key. ex raw content of ~/.ssh/id_rsa" + description: "Content of the SSH proxy private key (e.g., the raw content of ~/.ssh/id_rsa)." proxy_key_path: - description: "path of ssh proxy private key" + description: "Path to the SSH proxy private key file." proxy_fingerprint: - description: "fingerprint SHA256 of the host public key, default is to skip verification" + description: "SHA256 fingerprint of the proxy host's public key. If not set, host key verification is skipped (not recommended for production)." proxy_use_insecure_cipher: - description: "include more ciphers with use_insecure_cipher" + description: "Enable additional, less secure ciphers for the proxy connection. Not recommended unless required." curl_insecure: description: "When true, uses the --insecure option with curl for insecure downloads." default: "false" -- 2.54.0 From e55e4eabdc67ed49269ffb7d0d234f9c83facbca Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 11:21:28 +0800 Subject: [PATCH 55/69] docs: refine and expand documentation for variable configuration - Rewrite and clarify SCP action and SSH proxy table variable descriptions for accuracy and detail - Add new variables: debug, curl_insecure, capture_stdout, and version to the documentation - Improve formatting and make default values more consistent and explicit in documentation Signed-off-by: appleboy --- README.md | 73 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index b08c715..f35aabe 100644 --- a/README.md +++ b/README.md @@ -34,44 +34,47 @@ jobs: See the [action.yml](./action.yml) file for more detail information. -| Variable | Description | Default Value | -| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------- | -| host | SCP remote host | - | -| port | SCP remote port | `22` | -| username | SCP username | - | -| password | SCP password | - | -| passphrase | The passphrase is usually used to encrypt the private key | - | -| protocol | The IP protocol to use. Valid values are `tcp`, `tcp4`, or `tcp6`. | `tcp` | -| fingerprint | Fingerprint SHA256 of the host public key. Default is to skip verification | - | -| timeout | Timeout for SSH to remote host | `30s` | -| command_timeout | Timeout for SCP command | `10m` | -| key | Content of SSH private key. e.g., raw content of ~/.ssh/id_rsa | - | -| key_path | Path of SSH private key | - | -| target | Target path on the server, must be a directory (**required**) | - | -| source | SCP file list (**required**) | - | -| rm | Remove target folder before uploading data | `false` | -| strip_components | Remove the specified number of leading path elements | - | -| overwrite | Use `--overwrite` flag with tar, overwrite existing files when extracting | - | -| tar_tmp_path | Temporary path for tar file on the destination host | - | -| tar_exec | Path to tar executable on the destination host | `tar` | -| tar_dereference | Use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to | - | -| use_insecure_cipher | Include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) | - | +| Variable | Description | Default Value | +| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------- | +| host | Remote host address for SCP (e.g., example.com or 192.168.1.1). | - | +| port | Remote SSH port for SCP. Default: 22. | 22 | +| username | Username for SSH authentication. | - | +| password | Password for SSH authentication (not recommended; use SSH keys if possible). | - | +| protocol | IP protocol to use. Valid values: 'tcp', 'tcp4', or 'tcp6'. Default: tcp. | tcp | +| timeout | Timeout for establishing SSH connection to the remote host. Default: 30s. | 30s | +| command_timeout | Timeout for the SCP command execution. Default: 10m. | 10m | +| key | Content of the SSH private key (e.g., the raw content of ~/.ssh/id_rsa). | - | +| key_path | Path to the SSH private key file. | - | +| passphrase | Passphrase for the SSH private key, if required. | - | +| fingerprint | SHA256 fingerprint of the host's public key. If not set, host key verification is skipped (not recommended for production). | - | +| use_insecure_cipher | Enable additional, less secure ciphers for compatibility. Not recommended unless required. | - | +| target | Target directory path on the remote server. Must be a directory. | - | +| source | List of files or directories to transfer (local paths). | - | +| rm | Remove the target directory on the server before uploading new data. | - | +| debug | Enable debug messages for troubleshooting. | - | +| strip_components | Remove the specified number of leading path elements when extracting files. | - | +| overwrite | Use the --overwrite flag with tar to overwrite existing files. | - | +| tar_dereference | Use the --dereference flag with tar to follow symlinks. | - | +| tar_tmp_path | Temporary path for the tar file on the destination host. | - | +| tar_exec | Path to the tar executable on the destination host. Default: tar. | tar | +| curl_insecure | When true, uses the --insecure option with curl for insecure downloads. | false | +| capture_stdout | When true, captures and returns standard output from the commands as action output. | false | +| version | The version of drone-scp to use. | - | SSH Proxy Setting: -| Variable | Description | Default Value | -| ------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------- | -| proxy_host | Proxy host | - | -| proxy_port | Proxy port | `22` | -| proxy_username | Proxy username | - | -| proxy_password | Proxy password | - | -| proxy_protocol | The IP protocol to use. Valid values are `tcp`, `tcp4`, or `tcp6`. | `tcp` | -| proxy_passphrase | The passphrase is usually used to encrypt the private key | - | -| proxy_timeout | Timeout for SSH to proxy host | `30s` | -| proxy_key | Content of SSH proxy private key | - | -| proxy_key_path | Path of SSH proxy private key | - | -| proxy_fingerprint | Fingerprint SHA256 of the host public key. Default is to skip verification | - | -| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) | - | +| Variable | Description | Default Value | +| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------- | +| proxy_host | Remote host address for SSH proxy. | - | +| proxy_port | SSH proxy port. Default: 22. | 22 | +| proxy_username | Username for SSH proxy authentication. | - | +| proxy_password | Password for SSH proxy authentication. | - | +| proxy_passphrase | Passphrase for the SSH proxy private key, if required. | - | +| proxy_timeout | Timeout for establishing SSH connection to the proxy host. Default: 30s. | 30s | +| proxy_key | Content of the SSH proxy private key (e.g., the raw content of ~/.ssh/id_rsa). | - | +| proxy_key_path | Path to the SSH proxy private key file. | - | +| proxy_fingerprint | SHA256 fingerprint of the proxy host's public key. If not set, host key verification is skipped (not recommended for production). | - | +| proxy_use_insecure_cipher | Enable additional, less secure ciphers for the proxy connection. Not recommended unless required. | - | ## Setting up a SSH Key -- 2.54.0 From bf323b87290f84da784331d4b2ec2662b6a790a2 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 11:26:37 +0800 Subject: [PATCH 56/69] docs: overhaul and enrich documentation for clarity and onboarding - Revamp and reorganize the documentation with a new feature list and table of contents - Add sections dedicated to features, configuration options, best practices, cross-platform usage, troubleshooting, workflow diagram, and FAQ - Update and expand usage examples, including multi-server, changed-files-only, artifact integration, and Windows scenarios - Improve clarity, formatting, and structure throughout the README - Remove redundant and outdated examples and notes - Provide clearer and more secure SSH key setup instructions - Document common error codes and their solutions - Improve quick start and workflow setup steps for better user onboarding Signed-off-by: appleboy --- README.md | 512 ++++++++++++++++++++++++++---------------------------- 1 file changed, 246 insertions(+), 266 deletions(-) diff --git a/README.md b/README.md index f35aabe..1c56042 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,62 @@ [![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) -**Important**: Only supports **Linux** [docker](https://www.docker.com/) containers. +> **Note:** Only supports **Linux** [docker](https://www.docker.com/) containers. -## Usage +--- -Copy files and artifacts via SSH: +## ✨ Features + +- ✅ Copy files and artifacts to one or multiple remote servers via SSH +- ✅ Supports both SSH key and password authentication +- ✅ Full SSH Proxy (jump host) support +- ✅ Handles Linux ↔ Windows path conversion +- ✅ Integrates with GitHub Artifacts workflow +- ✅ Incremental and differential file transfer +- ✅ Rich configuration options for advanced use cases + +--- + +## 📦 Table of Contents + +- [🚀 SCP for GitHub Actions](#-scp-for-github-actions) + - [✨ Features](#-features) + - [📦 Table of Contents](#-table-of-contents) + - [🚀 Quick Start](#-quick-start) + - [⚙️ Configuration](#️-configuration) + - [🔌 Connection Settings](#-connection-settings) + - [📁 File Transfer Settings](#-file-transfer-settings) + - [🌐 Proxy Settings](#-proxy-settings) + - [🛡️ Best Practices \& Security](#️-best-practices--security) + - [🖥️ Cross-Platform Notes](#️-cross-platform-notes) + - [💡 Usage Examples](#-usage-examples) + - [🧩 Scenario Guide](#-scenario-guide) + - [Example 1: Basic SSH Password](#example-1-basic-ssh-password) + - [Example 2: Multi-server](#example-2-multi-server) + - [Example 3: Changed Files Only](#example-3-changed-files-only) + - [Example 4: Artifacts Integration](#example-4-artifacts-integration) + - [Example 5: Windows Server](#example-5-windows-server) + - [🗝️ SSH Key Setup](#️-ssh-key-setup) + - [🧰 Common Error Codes](#-common-error-codes) + - [🔄 Workflow Diagram](#-workflow-diagram) + - [FAQ \& Troubleshooting](#faq--troubleshooting) + - [📝 License](#-license) + +--- + +## 🚀 Quick Start + +Copy files and artifacts via SSH in your GitHub Actions workflow: ```yaml name: scp files on: [push] jobs: build: - name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: copy file via ssh password + - name: Copy files via SSH uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} @@ -30,121 +70,105 @@ jobs: target: your_server_target_folder_path ``` -## Input variables +--- -See the [action.yml](./action.yml) file for more detail information. +## ⚙️ Configuration -| Variable | Description | Default Value | -| ------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------- | -| host | Remote host address for SCP (e.g., example.com or 192.168.1.1). | - | -| port | Remote SSH port for SCP. Default: 22. | 22 | -| username | Username for SSH authentication. | - | -| password | Password for SSH authentication (not recommended; use SSH keys if possible). | - | -| protocol | IP protocol to use. Valid values: 'tcp', 'tcp4', or 'tcp6'. Default: tcp. | tcp | -| timeout | Timeout for establishing SSH connection to the remote host. Default: 30s. | 30s | -| command_timeout | Timeout for the SCP command execution. Default: 10m. | 10m | -| key | Content of the SSH private key (e.g., the raw content of ~/.ssh/id_rsa). | - | -| key_path | Path to the SSH private key file. | - | -| passphrase | Passphrase for the SSH private key, if required. | - | -| fingerprint | SHA256 fingerprint of the host's public key. If not set, host key verification is skipped (not recommended for production). | - | -| use_insecure_cipher | Enable additional, less secure ciphers for compatibility. Not recommended unless required. | - | -| target | Target directory path on the remote server. Must be a directory. | - | -| source | List of files or directories to transfer (local paths). | - | -| rm | Remove the target directory on the server before uploading new data. | - | -| debug | Enable debug messages for troubleshooting. | - | -| strip_components | Remove the specified number of leading path elements when extracting files. | - | -| overwrite | Use the --overwrite flag with tar to overwrite existing files. | - | -| tar_dereference | Use the --dereference flag with tar to follow symlinks. | - | -| tar_tmp_path | Temporary path for the tar file on the destination host. | - | -| tar_exec | Path to the tar executable on the destination host. Default: tar. | tar | -| curl_insecure | When true, uses the --insecure option with curl for insecure downloads. | false | -| capture_stdout | When true, captures and returns standard output from the commands as action output. | false | -| version | The version of drone-scp to use. | - | +### 🔌 Connection Settings -SSH Proxy Setting: +| Variable | Description | Default | Required | +| --------------- | -------------------------------------------- | ------- | -------- | +| host | Remote host(s), comma-separated for multiple | - | ✓ | +| port | SSH port | 22 | | +| username | SSH username | - | ✓ | +| password | SSH password (prefer SSH key for security) | - | | +| key | SSH private key content | - | | +| key_path | Path to SSH private key file | - | | +| passphrase | Passphrase for SSH private key | - | | +| fingerprint | SHA256 fingerprint for host key verification | - | | +| protocol | IP protocol: 'tcp', 'tcp4', or 'tcp6' | tcp | | +| timeout | SSH connection timeout | 30s | | +| command_timeout | SCP command timeout | 10m | | -| Variable | Description | Default Value | -| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------- | -| proxy_host | Remote host address for SSH proxy. | - | -| proxy_port | SSH proxy port. Default: 22. | 22 | -| proxy_username | Username for SSH proxy authentication. | - | -| proxy_password | Password for SSH proxy authentication. | - | -| proxy_passphrase | Passphrase for the SSH proxy private key, if required. | - | -| proxy_timeout | Timeout for establishing SSH connection to the proxy host. Default: 30s. | 30s | -| proxy_key | Content of the SSH proxy private key (e.g., the raw content of ~/.ssh/id_rsa). | - | -| proxy_key_path | Path to the SSH proxy private key file. | - | -| proxy_fingerprint | SHA256 fingerprint of the proxy host's public key. If not set, host key verification is skipped (not recommended for production). | - | -| proxy_use_insecure_cipher | Enable additional, less secure ciphers for the proxy connection. Not recommended unless required. | - | +### 📁 File Transfer Settings -## Setting up a SSH Key +| Variable | Description | Default | Security Note | +| ---------------- | ------------------------------------------------------- | ------- | ---------------------- | +| source | Local files/directories to transfer (comma-separated) | - | Use explicit paths | +| target | Target directory on remote server (must be a directory) | - | Avoid root directories | +| rm | Remove target directory before upload | - | Use with caution | +| strip_components | Remove leading path elements when extracting | - | | +| overwrite | Overwrite existing files with tar | - | | +| tar_dereference | Follow symlinks with tar | - | | +| tar_tmp_path | Temp path for tar file on destination | - | | +| tar_exec | Path to tar executable on destination | tar | | +| debug | Enable debug output | - | | +| curl_insecure | Use --insecure with curl | false | Not recommended | +| capture_stdout | Capture command stdout as action output | false | | +| version | Version of drone-scp to use | - | | -Make sure to follow the steps below when creating and using SSH keys. -The best practice is to create the SSH keys on the local machine, not the remote machine. -Log in with the username specified in GitHub Secrets and generate an RSA key pair: +### 🌐 Proxy Settings -```bash -# rsa -ssh-keygen -t rsa -b 4096 -C "your_email@example.com" +| Variable | Description | Default | Required | +| ------------------------- | ------------------------------------ | ------- | -------- | +| proxy_host | SSH proxy host | - | | +| proxy_port | SSH proxy port | 22 | | +| proxy_username | SSH proxy username | - | | +| proxy_password | SSH proxy password | - | | +| proxy_key | SSH proxy private key content | - | | +| proxy_key_path | Path to SSH proxy private key file | - | | +| proxy_passphrase | Passphrase for SSH proxy private key | - | | +| proxy_fingerprint | SHA256 fingerprint for proxy host | - | | +| proxy_use_insecure_cipher | Enable less secure ciphers for proxy | - | | +| proxy_timeout | SSH proxy connection timeout | 30s | | -# ed25519 -ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" -``` +--- -Add newly generated key into Authorized keys. Read more about authorized keys [here](https://www.ssh.com/ssh/authorized_keys/). +## 🛡️ Best Practices & Security -```bash -# rsa -cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys' +- **Prefer SSH key authentication** over passwords for better security. +- Store all sensitive values (host, username, password, key) in **GitHub Secrets**. +- Regularly **rotate deployment keys** (suggested every 90 days). +- Restrict write permissions on the target server directory. +- Enable host key fingerprint verification to prevent MITM attacks. +- Avoid using root as the SSH user. -# d25519 -cat .ssh/id_ed25519.pub | ssh b@B 'cat >> .ssh/authorized_keys' -``` +--- -Copy Private Key content and paste in Github Secrets. +## 🖥️ Cross-Platform Notes -```bash -# rsa -clip < ~/.ssh/id_rsa +| Scenario | Linux Server | Windows Server | +| ---------------- | -------------- | ----------------------- | +| Path Format | `/path/to/dir` | `/c/path/to/dir` | +| Required Setting | None | `tar_dereference: true` | +| Permissions | Preserved | May require manual ACL | +| Shell | bash (default) | Git Bash via OpenSSH | -# ed25519 -clip < ~/.ssh/id_ed25519 -``` +> 🚩 **Important:** +> When copying to Windows servers: +> +> - Install Git for Windows and set OpenSSH default shell to Git Bash +> - Use Unix-style target paths (e.g., `/c/Users/...`) +> - Enable `tar_dereference` for symlink handling -See the detail information about [SSH login without password](http://www.linuxproblem.org/art_9.html). +--- -**A note** from one of our readers: Depending on your version of SSH you might also have to do the following changes: +## 💡 Usage Examples -- Put the public key in `.ssh/authorized_keys2` -- Change the permissions of `.ssh` to 700 -- Change the permissions of `.ssh/authorized_keys2` to 640 +### 🧩 Scenario Guide -### If you are using OpenSSH +- **Basic file transfer** → [Example 1](#example-1-basic-ssh-password) +- **Multi-server deployment** → [Example 2](#example-2-multi-server) +- **Incremental/changed files only** → [Example 3](#example-3-changed-files-only) +- **Artifacts integration** → [Example 4](#example-4-artifacts-integration) +- **Windows server setup** → [Example 5](#example-5-windows-server) -If you are currently using OpenSSH and are getting the following error: +--- -```bash -ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey] -``` - -Make sure that your key algorithm of choice is supported. -On Ubuntu 20.04 or later you must explicitly allow the use of the ssh-rsa algorithm. Add the following line to your OpenSSH daemon file (which is either `/etc/ssh/sshd_config` or a drop-in file under `/etc/ssh/sshd_config.d/`): - -```bash -CASignatureAlgorithms +ssh-rsa -``` - -Alternatively, `ed25519` keys are accepted by default in OpenSSH. You could use this instead of rsa if needed: - -```bash -ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" -``` - -## Example - -Copy file via a SSH password: +#### Example 1: Basic SSH Password ```yaml -- name: copy file via ssh password +- name: Copy file via SSH password uses: appleboy/scp-action@v0.1.7 with: host: example.com @@ -155,55 +179,13 @@ Copy file via a SSH password: target: your_server_target_folder_path ``` -Using the environment variables +#### Example 2: Multi-server ```yaml -- name: copy file via ssh password +- name: Copy to multiple servers uses: appleboy/scp-action@v0.1.7 with: - host: ${{ env.HOST }} - username: ${{ env.USERNAME }} - password: ${{ secrets.PASSWORD }} - port: ${{ env.PORT }} - source: "tests/a.txt,tests/b.txt" - target: ${{ env.TARGET_PATH }} -``` - -Copy file via a SSH key: - -```yaml -- name: copy file via ssh key - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - port: ${{ secrets.PORT }} - key: ${{ secrets.KEY }} - source: "tests/a.txt,tests/b.txt" - target: your_server_target_folder_path -``` - -Example configuration for ignore list: - -```yaml -- name: copy file via ssh key - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - port: ${{ secrets.PORT }} - key: ${{ secrets.KEY }} - source: "tests/*.txt,!tests/a.txt" - target: your_server_target_folder_path -``` - -Example configuration for multiple servers: - -```diff - uses: appleboy/scp-action@v0.1.7 - with: -- host: "example.com" -+ host: "foo.com,bar.com" + host: "foo.com,bar.com" username: foo password: bar port: 22 @@ -211,155 +193,153 @@ Example configuration for multiple servers: target: your_server_target_folder_path ``` -Example configuration for exclude custom files: +#### Example 3: Changed Files Only ```yaml - uses: appleboy/scp-action@v0.1.7 +- name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 with: - host: "example.com" - username: foo - password: bar - port: 22 -- source: "tests/*.txt" -+ source: "tests/*.txt,!tests/a.txt,!tests/b.txt" - target: your_server_target_folder_path -``` + since_last_remote_commit: true + separator: "," -Upload artifact files to remote server: - -```yaml -deploy: - name: 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@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - port: ${{ secrets.PORT }} - source: distfiles/* - target: your_server_target_folder_path -``` - -Remove the specified number of leading path elements: - -```yaml -- name: remove the specified number of leading path elements +- name: Copy changed files to server uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} - source: "tests/a.txt,tests/b.txt" + source: ${{ steps.changed-files.outputs.all_changed_files }} target: your_server_target_folder_path - strip_components: 1 ``` -Old target structure: - -```sh -foobar - └── tests - ├── a.txt - └── b.txt -``` - -New target structure: - -```sh -foobar - ├── a.txt - └── b.txt -``` - -Only copy files that are newer than the corresponding destination files: +#### Example 4: Artifacts Integration ```yaml -changes: - name: test changed-files - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 +- uses: actions/upload-artifact@v4 + with: + name: my-artifact + path: world.txt - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v35 - with: - since_last_remote_commit: true - separator: "," +- uses: actions/download-artifact@v4 + with: + name: my-artifact + path: distfiles - - name: copy file to server - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.KEY }} - port: ${{ secrets.PORT }} - source: ${{ steps.changed-files.outputs.all_changed_files }} - target: your_server_target_folder_path +- name: Copy artifact to server + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: distfiles/* + target: your_server_target_folder_path ``` -Protecting a Private Key. The purpose of the passphrase is usually to encrypt the private key. This makes the key file by itself useless to an attacker. It is not uncommon for files to leak from backups or decommissioned hardware, and hackers commonly exfiltrate files from compromised systems. +#### Example 5: Windows Server -```diff - - name: ssh key with passphrase - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.SSH2 }} -+ passphrase: ${{ secrets.PASSPHRASE }} - port: ${{ secrets.PORT }} - source: "tests/a.txt,tests/b.txt" - target: your_server_target_folder_path +```yaml +- name: Copy to Windows + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + source: "your_source_path" + target: "/c/path/to/target/" + tar_dereference: true + rm: true ``` -When copying files from a Linux runner to a Windows server, you should: +--- -1. Download git for Windows -2. Change the default OpenSSH shell to git bach with the following powershell command. -3. Set `tar_dereference` and `rm` variable to `true` in the YAML file -4. Avoid putting the `port` value through a variable -5. Convert the target path to a Unix path: `/c/path/to/target/` +## 🗝️ SSH Key Setup -Change the default OpenSSH shell to git bach with the following powershell command. +1. **Generate SSH Key** (on your local machine): -```powershell -New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$env:Programfiles\Git\bin\bash.exe" -PropertyType String -Force + ```bash + # RSA + ssh-keygen -t rsa -b 4096 -C "your_email@example.com" + # ED25519 + ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" + ``` + +2. **Add Public Key to Server**: + + ```bash + cat .ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys' + # or for ed25519 + cat .ssh/id_ed25519.pub | ssh user@host 'cat >> .ssh/authorized_keys' + ``` + +3. **Copy Private Key Content to GitHub Secrets**: + + ```bash + clip < ~/.ssh/id_rsa + # or + clip < ~/.ssh/id_ed25519 + ``` + +> See [SSH login without password](http://www.linuxproblem.org/art_9.html) for more details. + +**OpenSSH Note:** +If you see `ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey]`, ensure your key algorithm is supported. +On Ubuntu 20.04+, add to `/etc/ssh/sshd_config` or `/etc/ssh/sshd_config.d/`: + +```sh +CASignatureAlgorithms +ssh-rsa ``` -Convert the target path to a Unix path: `/c/path/to/target/` +Or use ed25519 keys, which are accepted by default. -```diff - - name: Copy to Windows - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.HOST }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - port: 22 - source: 'your_source_path' -- target: 'C:\path\to\target' -+ target: '/c/path/to/target/' -+ tar_dereference: true -+ rm: true +--- + +## 🧰 Common Error Codes + +| Error Code | Possible Cause | Solution | +| -------------- | ---------------------------- | --------------------------------------------- | +| `ECONNREFUSED` | Wrong port / firewall blocks | Check port and firewall settings | +| `ENOENT` | Source file not found | Use absolute path or check checkout step | +| `EAUTH` | Authentication failed | Check key format and permissions (PEM format) | + +--- + +## 🔄 Workflow Diagram + +```mermaid +sequenceDiagram + participant G as GitHub Runner + participant S as Target Server + G->>S: Establish SSH connection + S-->>G: Authenticate credentials + G->>S: (Optional) Remove target directory + G->>G: Archive source files + G->>S: Transfer archive + S->>S: Extract and process files + S-->>G: Return result ``` + +--- + +## FAQ & Troubleshooting + +- **Q: Why does authentication fail?** + A: Check SSH key format, permissions, and that the key is added to the server. + +- **Q: How do I copy only changed files?** + A: Use `tj-actions/changed-files` to get changed files and pass to `source`. + +- **Q: How to deploy to multiple servers?** + A: Use comma-separated host list: `host: "foo.com,bar.com"` + +- **Q: How to copy to Windows?** + A: Set up Git Bash, use Unix-style paths, and enable `tar_dereference`. + +--- + +## 📝 License + +MIT License -- 2.54.0 From 17026f90b893f1e6ef4acfaf70d5a2c610bb9495 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 11:37:08 +0800 Subject: [PATCH 57/69] docs: add comprehensive Chinese documentation and localization support - Add links to Traditional and Simplified Chinese documentation in the README - Add a complete README in Simplified Chinese, including setup, configuration, usage examples, best practices, troubleshooting, and FAQ - Add a complete README in Traditional Chinese, including setup, configuration, usage examples, best practices, troubleshooting, and FAQ Signed-off-by: appleboy --- README.md | 2 + README.zh-cn.md | 347 ++++++++++++++++++++++++++++++++++++++++++++++++ README.zh-tw.md | 347 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 696 insertions(+) create mode 100644 README.zh-cn.md create mode 100644 README.zh-tw.md diff --git a/README.md b/README.md index 1c56042..5ff4710 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # 🚀 SCP for GitHub Actions +[繁體中文](README.zh-tw.md) | [简体中文](README.zh-cn.md) + [GitHub Action](https://github.com/features/actions) for copying files and artifacts via SSH. [![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) diff --git a/README.zh-cn.md b/README.zh-cn.md new file mode 100644 index 0000000..ba216b5 --- /dev/null +++ b/README.zh-cn.md @@ -0,0 +1,347 @@ +# 🚀 GitHub Actions 的 SCP + +[English](README.md) | [繁體中文](README.zh-tw.md) + +[GitHub Action](https://github.com/features/actions) 用于通过 SSH 复制文件和构建产物。 + +[![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) + +> **注意:** 仅支持 **Linux** [docker](https://www.docker.com/) 容器。 + +--- + +## ✨ 功能特性 + +- ✅ 通过 SSH 将文件和产物复制到一台或多台远程服务器 +- ✅ 支持 SSH 密钥和密码认证 +- ✅ 完全支持 SSH 代理(跳板机) +- ✅ 处理 Linux ↔ Windows 路径转换 +- ✅ 集成 GitHub Artifacts 工作流 +- ✅ 支持增量与差异文件传输 +- ✅ 丰富的高级配置选项 + +--- + +## 📦 目录 + +- [🚀 GitHub Actions 的 SCP](#-github-actions-的-scp) + - [✨ 功能特性](#-功能特性) + - [📦 目录](#-目录) + - [🚀 快速开始](#-快速开始) + - [⚙️ 配置说明](#️-配置说明) + - [🔌 连接设置](#-连接设置) + - [📁 文件传输设置](#-文件传输设置) + - [🌐 代理设置](#-代理设置) + - [🛡️ 最佳实践与安全性](#️-最佳实践与安全性) + - [🖥️ 跨平台注意事项](#️-跨平台注意事项) + - [💡 使用示例](#-使用示例) + - [🧩 场景导览](#-场景导览) + - [示例 1:基本 SSH 密码](#示例-1基本-ssh-密码) + - [示例 2:多台服务器](#示例-2多台服务器) + - [示例 3:仅传输变更文件](#示例-3仅传输变更文件) + - [示例 4:集成 Artifacts](#示例-4集成-artifacts) + - [示例 5:Windows 服务器](#示例-5windows-服务器) + - [🗝️ SSH 密钥设置](#️-ssh-密钥设置) + - [🧰 常见错误代码](#-常见错误代码) + - [🔄 工作流程图](#-工作流程图) + - [FAQ 与故障排查](#faq-与故障排查) + - [📝 许可证](#-许可证) + +--- + +## 🚀 快速开始 + +在 GitHub Actions 工作流中通过 SSH 复制文件和产物: + +```yaml +name: scp files +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: 通过 SSH 复制文件 + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: your_server_target_folder_path +``` + +--- + +## ⚙️ 配置说明 + +### 🔌 连接设置 + +| 变量 | 说明 | 默认值 | 必填 | +| --------------- | -------------------------------- | ------ | ---- | +| host | 远程主机(多台用逗号分隔) | - | ✓ | +| port | SSH 端口 | 22 | | +| username | SSH 用户名 | - | ✓ | +| password | SSH 密码(建议优先使用密钥认证) | - | | +| key | SSH 私钥内容 | - | | +| key_path | SSH 私钥文件路径 | - | | +| passphrase | SSH 私钥密码 | - | | +| fingerprint | 主机密钥 SHA256 指纹验证 | - | | +| protocol | IP 协议:'tcp'、'tcp4' 或 'tcp6' | tcp | | +| timeout | SSH 连接超时 | 30s | | +| command_timeout | SCP 命令超时 | 10m | | + +### 📁 文件传输设置 + +| 变量 | 说明 | 默认值 | 安全性说明 | +| ---------------- | --------------------------------- | ------ | -------------- | +| source | 本地要传输的文件/目录(逗号分隔) | - | 请使用明确路径 | +| target | 远程目标目录(必须为目录) | - | 避免使用根目录 | +| rm | 上传前移除目标目录 | - | 谨慎使用 | +| strip_components | 传输时移除前置路径元素 | - | | +| overwrite | 使用 tar 覆盖现有文件 | - | | +| tar_dereference | tar 传输时跟随符号链接 | - | | +| tar_tmp_path | 目标端 tar 临时文件路径 | - | | +| tar_exec | 目标端 tar 执行文件路径 | tar | | +| debug | 启用调试输出 | - | | +| curl_insecure | curl 使用 --insecure | false | 不推荐 | +| capture_stdout | 将命令 stdout 作为 action 输出 | false | | +| version | 指定 drone-scp 版本 | - | | + +### 🌐 代理设置 + +| 变量 | 说明 | 默认值 | 必填 | +| ------------------------- | -------------------------- | ------ | ---- | +| proxy_host | SSH 代理主机 | - | | +| proxy_port | SSH 代理端口 | 22 | | +| proxy_username | SSH 代理用户名 | - | | +| proxy_password | SSH 代理密码 | - | | +| proxy_key | SSH 代理私钥内容 | - | | +| proxy_key_path | SSH 代理私钥文件路径 | - | | +| proxy_passphrase | SSH 代理私钥密码 | - | | +| proxy_fingerprint | 代理主机 SHA256 指纹验证 | - | | +| proxy_use_insecure_cipher | 启用较不安全的代理加密算法 | - | | +| proxy_timeout | SSH 代理连接超时 | 30s | | + +--- + +## 🛡️ 最佳实践与安全性 + +- **建议优先使用 SSH 密钥认证**,提升安全性。 +- 将所有敏感信息(host、username、password、key)存放于 **GitHub Secrets**。 +- 定期**更换部署密钥**(建议每 90 天一次)。 +- 限制目标服务器目录的写入权限。 +- 启用主机密钥指纹验证以防止中间人攻击。 +- 避免使用 root 用户登录 SSH。 + +--- + +## 🖥️ 跨平台注意事项 + +| 场景 | Linux 服务器 | Windows 服务器 | +| -------- | -------------- | ----------------------- | +| 路径格式 | `/path/to/dir` | `/c/path/to/dir` | +| 必要设置 | 无 | `tar_dereference: true` | +| 权限 | 保留 | 可能需手动设置 ACL | +| Shell | bash(默认) | Git Bash(OpenSSH) | + +> 🚩 **重要提醒:** +> 复制到 Windows 服务器时: +> +> - 安装 Git for Windows 并将 OpenSSH 默认 shell 设为 Git Bash +> - 使用类 Unix 目标路径(如 `/c/Users/...`) +> - 启用 `tar_dereference` 处理符号链接 + +--- + +## 💡 使用示例 + +### 🧩 场景导览 + +- **基本文件传输** → [示例 1](#示例-1基本-ssh-密码) +- **多台服务器部署** → [示例 2](#示例-2多台服务器) +- **仅传输变更文件** → [示例 3](#示例-3仅传输变更文件) +- **集成 Artifacts** → [示例 4](#示例-4集成-artifacts) +- **Windows 服务器设置** → [示例 5](#示例-5windows-服务器) + +--- + +#### 示例 1:基本 SSH 密码 + +```yaml +- name: 通过 SSH 密码复制文件 + uses: appleboy/scp-action@v0.1.7 + with: + host: example.com + username: foo + password: bar + port: 22 + source: "tests/a.txt,tests/b.txt" + target: your_server_target_folder_path +``` + +#### 示例 2:多台服务器 + +```yaml +- name: 复制到多台服务器 + uses: appleboy/scp-action@v0.1.7 + with: + host: "foo.com,bar.com" + username: foo + password: bar + port: 22 + source: "tests/a.txt,tests/b.txt" + target: your_server_target_folder_path +``` + +#### 示例 3:仅传输变更文件 + +```yaml +- name: 获取变更文件 + id: changed-files + uses: tj-actions/changed-files@v35 + with: + since_last_remote_commit: true + separator: "," + +- name: 复制变更文件到服务器 + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: ${{ steps.changed-files.outputs.all_changed_files }} + target: your_server_target_folder_path +``` + +#### 示例 4:集成 Artifacts + +```yaml +- uses: actions/upload-artifact@v4 + with: + name: my-artifact + path: world.txt + +- uses: actions/download-artifact@v4 + with: + name: my-artifact + path: distfiles + +- name: 复制 artifact 到服务器 + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: distfiles/* + target: your_server_target_folder_path +``` + +#### 示例 5:Windows 服务器 + +```yaml +- name: 复制到 Windows + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + source: "your_source_path" + target: "/c/path/to/target/" + tar_dereference: true + rm: true +``` + +--- + +## 🗝️ SSH 密钥设置 + +1. **生成 SSH 密钥**(在本地执行): + + ```bash + # RSA + ssh-keygen -t rsa -b 4096 -C "your_email@example.com" + # ED25519 + ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" + ``` + +2. **将公钥添加到服务器**: + + ```bash + cat .ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys' + # 或 ed25519 + cat .ssh/id_ed25519.pub | ssh user@host 'cat >> .ssh/authorized_keys' + ``` + +3. **将私钥内容复制到 GitHub Secrets**: + + ```bash + clip < ~/.ssh/id_rsa + # 或 + clip < ~/.ssh/id_ed25519 + ``` + +> 更多细节请参考 [SSH 免密登录](http://www.linuxproblem.org/art_9.html)。 + +**OpenSSH 注意事项:** +如遇到 `ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey]`,请确认密钥算法已被支持。 +Ubuntu 20.04+ 可在 `/etc/ssh/sshd_config` 或 `/etc/ssh/sshd_config.d/` 添加: + +```sh +CASignatureAlgorithms +ssh-rsa +``` + +或使用 ed25519 密钥(默认支持)。 + +--- + +## 🧰 常见错误代码 + +| 错误代码 | 可能原因 | 解决方法 | +| -------------- | ------------------- | --------------------------------- | +| `ECONNREFUSED` | 端口错误/防火墙阻挡 | 检查端口和防火墙设置 | +| `ENOENT` | 找不到源文件 | 使用绝对路径或检查 checkout 步骤 | +| `EAUTH` | 认证失败 | 检查密钥格式和权限(需 PEM 格式) | + +--- + +## 🔄 工作流程图 + +```mermaid +sequenceDiagram + participant G as GitHub Runner + participant S as Target Server + G->>S: 建立 SSH 连接 + S-->>G: 验证凭证 + G->>S: (可选)移除目标目录 + G->>G: 打包源文件 + G->>S: 传输打包文件 + S->>S: 解压和处理文件 + S-->>G: 返回结果 +``` + +--- + +## FAQ 与故障排查 + +- **Q: 为什么认证失败?** + A: 请检查 SSH 密钥格式、权限,以及密钥是否已添加到服务器。 + +- **Q: 如何只复制变更文件?** + A: 使用 `tj-actions/changed-files` 获取变更文件并传递给 `source`。 + +- **Q: 如何部署到多台服务器?** + A: `host` 参数用逗号分隔多台主机,例如:`host: "foo.com,bar.com"` + +- **Q: 如何复制到 Windows?** + A: 设置 Git Bash,使用类 Unix 路径,并启用 `tar_dereference`。 + +--- + +## 📝 许可证 + +MIT License diff --git a/README.zh-tw.md b/README.zh-tw.md new file mode 100644 index 0000000..3895fd0 --- /dev/null +++ b/README.zh-tw.md @@ -0,0 +1,347 @@ +# 🚀 GitHub Actions 的 SCP + +[English](README.md) | [简体中文](README.zh-cn.md) + +[GitHub Action](https://github.com/features/actions) 用於透過 SSH 複製檔案與產物。 + +[![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) + +> **注意:** 只支援 **Linux** [docker](https://www.docker.com/) 容器。 + +--- + +## ✨ 功能特色 + +- ✅ 透過 SSH 將檔案與產物複製到一台或多台遠端伺服器 +- ✅ 支援 SSH 金鑰與密碼驗證 +- ✅ 完整支援 SSH Proxy(跳板機) +- ✅ 處理 Linux ↔ Windows 路徑轉換 +- ✅ 整合 GitHub Artifacts 工作流程 +- ✅ 支援增量與差異檔案傳輸 +- ✅ 豐富的進階設定選項 + +--- + +## 📦 目錄 + +- [🚀 GitHub Actions 的 SCP](#-github-actions-的-scp) + - [✨ 功能特色](#-功能特色) + - [📦 目錄](#-目錄) + - [🚀 快速開始](#-快速開始) + - [⚙️ 設定說明](#️-設定說明) + - [🔌 連線設定](#-連線設定) + - [📁 檔案傳輸設定](#-檔案傳輸設定) + - [🌐 Proxy 設定](#-proxy-設定) + - [🛡️ 最佳實踐與安全性](#️-最佳實踐與安全性) + - [🖥️ 跨平台注意事項](#️-跨平台注意事項) + - [💡 使用範例](#-使用範例) + - [🧩 情境導覽](#-情境導覽) + - [範例 1:基本 SSH 密碼](#範例-1基本-ssh-密碼) + - [範例 2:多台伺服器](#範例-2多台伺服器) + - [範例 3:僅傳送變更檔案](#範例-3僅傳送變更檔案) + - [範例 4:整合 Artifacts](#範例-4整合-artifacts) + - [範例 5:Windows 伺服器](#範例-5windows-伺服器) + - [🗝️ SSH 金鑰設定](#️-ssh-金鑰設定) + - [🧰 常見錯誤代碼](#-常見錯誤代碼) + - [🔄 工作流程圖](#-工作流程圖) + - [FAQ 與疑難排解](#faq-與疑難排解) + - [📝 授權條款](#-授權條款) + +--- + +## 🚀 快速開始 + +在 GitHub Actions 工作流程中透過 SSH 複製檔案與產物: + +```yaml +name: scp files +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: 透過 SSH 複製檔案 + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.PORT }} + source: "tests/a.txt,tests/b.txt" + target: your_server_target_folder_path +``` + +--- + +## ⚙️ 設定說明 + +### 🔌 連線設定 + +| 變數 | 說明 | 預設值 | 必填 | +| --------------- | ------------------------------------ | ------ | ---- | +| host | 遠端主機(多台以逗號分隔) | - | ✓ | +| port | SSH 連接埠 | 22 | | +| username | SSH 使用者名稱 | - | ✓ | +| password | SSH 密碼(建議使用金鑰以提升安全性) | - | | +| key | SSH 私鑰內容 | - | | +| key_path | SSH 私鑰檔案路徑 | - | | +| passphrase | SSH 私鑰密碼 | - | | +| fingerprint | 主機金鑰 SHA256 指紋驗證 | - | | +| protocol | IP 協定:'tcp'、'tcp4' 或 'tcp6' | tcp | | +| timeout | SSH 連線逾時 | 30s | | +| command_timeout | SCP 指令逾時 | 10m | | + +### 📁 檔案傳輸設定 + +| 變數 | 說明 | 預設值 | 安全性說明 | +| ---------------- | --------------------------------- | ------ | -------------- | +| source | 本地要傳送的檔案/目錄(逗號分隔) | - | 請使用明確路徑 | +| target | 遠端目標目錄(必須為目錄) | - | 避免使用根目錄 | +| rm | 上傳前移除目標目錄 | - | 請小心使用 | +| strip_components | 傳送時移除前置路徑元素 | - | | +| overwrite | 使用 tar 覆蓋現有檔案 | - | | +| tar_dereference | tar 傳送時跟隨符號連結 | - | | +| tar_tmp_path | 目標端 tar 暫存檔路徑 | - | | +| tar_exec | 目標端 tar 執行檔路徑 | tar | | +| debug | 啟用除錯輸出 | - | | +| curl_insecure | curl 使用 --insecure | false | 不建議 | +| capture_stdout | 將指令 stdout 作為 action 輸出 | false | | +| version | 指定 drone-scp 版本 | - | | + +### 🌐 Proxy 設定 + +| 變數 | 說明 | 預設值 | 必填 | +| ------------------------- | ------------------------------- | ------ | ---- | +| proxy_host | SSH Proxy 主機 | - | | +| proxy_port | SSH Proxy 連接埠 | 22 | | +| proxy_username | SSH Proxy 使用者名稱 | - | | +| proxy_password | SSH Proxy 密碼 | - | | +| proxy_key | SSH Proxy 私鑰內容 | - | | +| proxy_key_path | SSH Proxy 私鑰檔案路徑 | - | | +| proxy_passphrase | SSH Proxy 私鑰密碼 | - | | +| proxy_fingerprint | Proxy 主機 SHA256 指紋驗證 | - | | +| proxy_use_insecure_cipher | 啟用較不安全的 Proxy 加密演算法 | - | | +| proxy_timeout | SSH Proxy 連線逾時 | 30s | | + +--- + +## 🛡️ 最佳實踐與安全性 + +- **建議優先使用 SSH 金鑰驗證**,提升安全性。 +- 將所有敏感資訊(host、username、password、key)存放於 **GitHub Secrets**。 +- 定期**更換部署金鑰**(建議每 90 天一次)。 +- 限制目標伺服器目錄的寫入權限。 +- 啟用主機金鑰指紋驗證以防止中間人攻擊。 +- 避免使用 root 帳號登入 SSH。 + +--- + +## 🖥️ 跨平台注意事項 + +| 情境 | Linux 伺服器 | Windows 伺服器 | +| -------- | -------------- | ----------------------- | +| 路徑格式 | `/path/to/dir` | `/c/path/to/dir` | +| 必要設定 | 無 | `tar_dereference: true` | +| 權限 | 保留 | 可能需手動設定 ACL | +| Shell | bash (預設) | Git Bash(OpenSSH) | + +> 🚩 **重要提醒:** +> 複製到 Windows 伺服器時: +> +> - 安裝 Git for Windows 並將 OpenSSH 預設 shell 設為 Git Bash +> - 使用 Unix 風格目標路徑(如 `/c/Users/...`) +> - 啟用 `tar_dereference` 處理符號連結 + +--- + +## 💡 使用範例 + +### 🧩 情境導覽 + +- **基本檔案傳輸** → [範例 1](#範例-1基本-ssh-密碼) +- **多台伺服器部署** → [範例 2](#範例-2多台伺服器) +- **僅傳送變更檔案** → [範例 3](#範例-3僅傳送變更檔案) +- **整合 Artifacts** → [範例 4](#範例-4整合-artifacts) +- **Windows 伺服器設定** → [範例 5](#範例-5windows-伺服器) + +--- + +#### 範例 1:基本 SSH 密碼 + +```yaml +- name: 透過 SSH 密碼複製檔案 + uses: appleboy/scp-action@v0.1.7 + with: + host: example.com + username: foo + password: bar + port: 22 + source: "tests/a.txt,tests/b.txt" + target: your_server_target_folder_path +``` + +#### 範例 2:多台伺服器 + +```yaml +- name: 複製到多台伺服器 + uses: appleboy/scp-action@v0.1.7 + with: + host: "foo.com,bar.com" + username: foo + password: bar + port: 22 + source: "tests/a.txt,tests/b.txt" + target: your_server_target_folder_path +``` + +#### 範例 3:僅傳送變更檔案 + +```yaml +- name: 取得變更檔案 + id: changed-files + uses: tj-actions/changed-files@v35 + with: + since_last_remote_commit: true + separator: "," + +- name: 複製變更檔案到伺服器 + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: ${{ steps.changed-files.outputs.all_changed_files }} + target: your_server_target_folder_path +``` + +#### 範例 4:整合 Artifacts + +```yaml +- uses: actions/upload-artifact@v4 + with: + name: my-artifact + path: world.txt + +- uses: actions/download-artifact@v4 + with: + name: my-artifact + path: distfiles + +- name: 複製 artifact 到伺服器 + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + source: distfiles/* + target: your_server_target_folder_path +``` + +#### 範例 5:Windows 伺服器 + +```yaml +- name: 複製到 Windows + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + source: "your_source_path" + target: "/c/path/to/target/" + tar_dereference: true + rm: true +``` + +--- + +## 🗝️ SSH 金鑰設定 + +1. **產生 SSH 金鑰**(於本地端執行): + + ```bash + # RSA + ssh-keygen -t rsa -b 4096 -C "your_email@example.com" + # ED25519 + ssh-keygen -t ed25519 -a 200 -C "your_email@example.com" + ``` + +2. **將公鑰加入伺服器**: + + ```bash + cat .ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys' + # 或 ed25519 + cat .ssh/id_ed25519.pub | ssh user@host 'cat >> .ssh/authorized_keys' + ``` + +3. **將私鑰內容複製到 GitHub Secrets**: + + ```bash + clip < ~/.ssh/id_rsa + # 或 + clip < ~/.ssh/id_ed25519 + ``` + +> 更多細節請參考 [SSH 無密碼登入](http://www.linuxproblem.org/art_9.html)。 + +**OpenSSH 注意事項:** +若出現 `ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey]`,請確認金鑰演算法支援。 +Ubuntu 20.04+ 可於 `/etc/ssh/sshd_config` 或 `/etc/ssh/sshd_config.d/` 加入: + +```sh +CASignatureAlgorithms +ssh-rsa +``` + +或改用 ed25519 金鑰(預設支援)。 + +--- + +## 🧰 常見錯誤代碼 + +| 錯誤代碼 | 可能原因 | 解決方式 | +| -------------- | --------------------- | --------------------------------- | +| `ECONNREFUSED` | 連接埠錯誤/防火牆阻擋 | 檢查連接埠與防火牆設定 | +| `ENOENT` | 找不到來源檔案 | 請用絕對路徑或檢查 checkout 步驟 | +| `EAUTH` | 驗證失敗 | 檢查金鑰格式與權限(需 PEM 格式) | + +--- + +## 🔄 工作流程圖 + +```mermaid +sequenceDiagram + participant G as GitHub Runner + participant S as Target Server + G->>S: 建立 SSH 連線 + S-->>G: 驗證憑證 + G->>S: (可選)移除目標目錄 + G->>G: 封存來源檔案 + G->>S: 傳送封存檔 + S->>S: 解壓與處理檔案 + S-->>G: 回傳結果 +``` + +--- + +## FAQ 與疑難排解 + +- **Q: 為什麼驗證失敗?** + A: 請檢查 SSH 金鑰格式、權限,以及金鑰是否已加入伺服器。 + +- **Q: 如何只複製變更檔案?** + A: 使用 `tj-actions/changed-files` 取得變更檔案並傳給 `source`。 + +- **Q: 如何部署到多台伺服器?** + A: `host` 參數用逗號分隔多台主機,例如:`host: "foo.com,bar.com"` + +- **Q: 如何複製到 Windows?** + A: 設定 Git Bash,使用 Unix 風格路徑,並啟用 `tar_dereference`。 + +--- + +## 📝 授權條款 + +MIT License -- 2.54.0 From f5c6c234bdfbf684bf3ea3735eb27caf06794b07 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 11:38:05 +0800 Subject: [PATCH 58/69] ci: align workflow naming with updated testing conventions - Rename the workflow file to testing.yml - Rename the workflow from "scp files" to "lint and test" Signed-off-by: appleboy --- .github/workflows/{ci.yml => testing.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{ci.yml => testing.yml} (99%) diff --git a/.github/workflows/ci.yml b/.github/workflows/testing.yml similarity index 99% rename from .github/workflows/ci.yml rename to .github/workflows/testing.yml index fb616d9..d9d40ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/testing.yml @@ -1,4 +1,4 @@ -name: scp files +name: lint and test on: [push] jobs: testing: -- 2.54.0 From 6b2d3092e33afb945be4e80af2cda12c88dcef2c Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 11:39:19 +0800 Subject: [PATCH 59/69] docs: update README badges to reference lint and test workflow - Update the badge in all READMEs to use the lint and test workflow instead of the previous Actions status badge Signed-off-by: appleboy --- README.md | 2 +- README.zh-cn.md | 2 +- README.zh-tw.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5ff4710..d0f5198 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [GitHub Action](https://github.com/features/actions) for copying files and artifacts via SSH. -[![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) +[![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 ba216b5..fef6eb1 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -4,7 +4,7 @@ [GitHub Action](https://github.com/features/actions) 用于通过 SSH 复制文件和构建产物。 -[![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) +[![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 3895fd0..5e7d40a 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -4,7 +4,7 @@ [GitHub Action](https://github.com/features/actions) 用於透過 SSH 複製檔案與產物。 -[![Actions Status](https://github.com/appleboy/scp-action/workflows/scp%20files/badge.svg)](https://github.com/appleboy/scp-action/actions) +[![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 6aff6492ae1d8325e24e6cd5f0f7392aee9617b6 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 12:41:00 +0800 Subject: [PATCH 60/69] chore: bump default DRONE_SCP_VERSION to 1.8.0 - Update the default DRONE_SCP_VERSION from 1.7.0 to 1.8.0 Signed-off-by: appleboy --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index bde81cd..bc99822 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,7 +6,7 @@ export GITHUB="true" GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH%/}" DRONE_SCP_RELEASE_URL="${DRONE_SCP_RELEASE_URL:-https://github.com/appleboy/drone-scp/releases/download}" -DRONE_SCP_VERSION="${DRONE_SCP_VERSION:-1.7.0}" +DRONE_SCP_VERSION="${DRONE_SCP_VERSION:-1.8.0}" function log_error() { echo "$1" >&2 -- 2.54.0 From ff85246acaad7bdce478db94a363cd2bf7c90345 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 12:42:05 +0800 Subject: [PATCH 61/69] docs: update documentation to use latest scp-action version - Update all usage references of appleboy/scp-action from v0.1.7 to v1 in documentation and examples Signed-off-by: appleboy --- README.md | 12 ++++++------ README.zh-cn.md | 12 ++++++------ README.zh-tw.md | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d0f5198..271da8a 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Copy files via SSH - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -171,7 +171,7 @@ jobs: ```yaml - name: Copy file via SSH password - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: example.com username: foo @@ -185,7 +185,7 @@ jobs: ```yaml - name: Copy to multiple servers - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: "foo.com,bar.com" username: foo @@ -206,7 +206,7 @@ jobs: separator: "," - name: Copy changed files to server - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -230,7 +230,7 @@ jobs: path: distfiles - name: Copy artifact to server - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -244,7 +244,7 @@ jobs: ```yaml - name: Copy to Windows - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} diff --git a/README.zh-cn.md b/README.zh-cn.md index fef6eb1..52994b7 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -62,7 +62,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: 通过 SSH 复制文件 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -171,7 +171,7 @@ jobs: ```yaml - name: 通过 SSH 密码复制文件 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: example.com username: foo @@ -185,7 +185,7 @@ jobs: ```yaml - name: 复制到多台服务器 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: "foo.com,bar.com" username: foo @@ -206,7 +206,7 @@ jobs: separator: "," - name: 复制变更文件到服务器 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -230,7 +230,7 @@ jobs: path: distfiles - name: 复制 artifact 到服务器 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -244,7 +244,7 @@ jobs: ```yaml - name: 复制到 Windows - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} diff --git a/README.zh-tw.md b/README.zh-tw.md index 5e7d40a..2a0e4a6 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -62,7 +62,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: 透過 SSH 複製檔案 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -171,7 +171,7 @@ jobs: ```yaml - name: 透過 SSH 密碼複製檔案 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: example.com username: foo @@ -185,7 +185,7 @@ jobs: ```yaml - name: 複製到多台伺服器 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: "foo.com,bar.com" username: foo @@ -206,7 +206,7 @@ jobs: separator: "," - name: 複製變更檔案到伺服器 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -230,7 +230,7 @@ jobs: path: distfiles - name: 複製 artifact 到伺服器 - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} @@ -244,7 +244,7 @@ jobs: ```yaml - name: 複製到 Windows - uses: appleboy/scp-action@v0.1.7 + uses: appleboy/scp-action@v1 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} -- 2.54.0 From 8b7c180c3f580afe122426543bdc249057f89fa1 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 27 Apr 2025 12:45:00 +0800 Subject: [PATCH 62/69] 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 63/69] 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 64/69] 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 65/69] 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 66/69] 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 67/69] 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 68/69] 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 69/69] 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