99 Commits

Author SHA1 Message Date
appleboy
bf323b8729 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 <appleboy.tw@gmail.com>
2025-04-27 11:26:37 +08:00
appleboy
e55e4eabdc 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 <appleboy.tw@gmail.com>
2025-04-27 11:21:28 +08:00
appleboy
bc835cba55 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 <appleboy.tw@gmail.com>
2025-04-27 11:16:12 +08:00
Bo-Yi Wu
98b7132065 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 <appleboy.tw@gmail.com>
2025-04-27 10:38:00 +08:00
appleboy
3d59448764 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 <appleboy.tw@gmail.com>
2024-12-25 09:04:14 +08:00
appleboy
2a829c0ed2 docs: improve API performance and update documentation
- Fix grammar in README to clarify Linux Docker container support

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-12-24 22:15:22 +08:00
Bo-Yi Wu
4f2c27bbc2 docs: improve documentation and testing configurations (#193)
- Add example for using environment variables with `scp-action` in README.md

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-12-24 22:09:30 +08:00
appleboy
b03d7257ae 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 <appleboy.tw@gmail.com>
2024-12-24 22:05:54 +08:00
appleboy
f042d742db ci(github): improve system performance and stability
- Downgrade `tj-actions/changed-files` action from version `v46` to `v45`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-10-29 21:22:29 +08:00
appleboy
ad9a378b7f 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 <appleboy.tw@gmail.com>
2024-10-28 22:38:25 +08:00
appleboy
172d4632fe feat(actions): improve API robustness and testing coverage
- Add `protocol` input with description and default value `tcp`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2024-10-28 22:33:53 +08:00
appleboy
93e17a47f9 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 <appleboy.tw@gmail.com>
2024-10-28 22:28:31 +08:00
appleboy
c6ff96b7f6 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 <appleboy.tw@gmail.com>
2024-10-07 22:41:36 +08:00
Bo-Yi Wu
7622c01418 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 <appleboy.tw@gmail.com>
2024-08-27 21:02:52 +08:00
dependabot[bot]
9ba62064d2 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-06 08:11:24 +08:00
dependabot[bot]
f314a5399e 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-19 09:42:58 +08:00
dependabot[bot]
699fa1181c 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-27 11:08:08 +08:00
Ilya Brin
9f34cc3e55 docs(readme): update dependency in example (#159)
Bumped GitHub Actions in README
2024-01-01 13:46:55 +08:00
Bo-Yi Wu
917f8b81df chore: update dependencies and improve compatibility with latest versions
Some checks failed
scp files / test scp action (push) Has been cancelled
scp files / test deploy artifact (push) Has been cancelled
scp files / test changed-files (push) Has been cancelled
scp files / test target folder (push) Has been cancelled
scp files / test Multiple Host (push) Has been cancelled
- Update the version of `appleboy/scp-action` from `v0.1.6` to `v0.1.7`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-01-01 13:45:26 +08:00
Bo-Yi Wu
78e7f475f3 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 <appleboy.tw@gmail.com>
2024-01-01 13:44:54 +08:00
Bo-Yi Wu
dfde1f50eb 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 <appleboy.tw@gmail.com>
2023-12-26 14:48:33 +08:00
Bo-Yi Wu
35093a99f9 chore: update drone-scp image to v1.6.13 (#158)
Some checks failed
scp files / test deploy artifact (push) Has been cancelled
scp files / test changed-files (push) Has been cancelled
scp files / test target folder (push) Has been cancelled
scp files / test Multiple Host (push) Has been cancelled
scp files / test scp action (push) Has been cancelled
- Update the drone-scp image from version `1.6.12` to `1.6.13` in the Dockerfile

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2023-12-26 13:54:08 +08:00
dependabot[bot]
96947ea2bd 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-26 10:40:41 +08:00
dependabot[bot]
aef31a66e3 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-26 10:40:20 +08:00
dependabot[bot]
950981a11d 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-26 10:39:54 +08:00
appleboy
5878fc908f chore: update appleboy/scp-action to v0.1.5
Some checks failed
scp files / test scp action (push) Failing after 3s
scp files / test deploy artifact (push) Failing after 19s
scp files / test target folder (push) Has been cancelled
scp files / test Multiple Host (push) Has been cancelled
scp files / test changed-files (push) Has been cancelled
- Update the version of `appleboy/scp-action` from `v0.1.4` to `v0.1.5`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2023-12-25 21:54:17 +08:00
Bo-Yi Wu
abb6d70bee 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 <appleboy.tw@gmail.com>

* update

Signed-off-by: appleboy <appleboy.tw@gmail.com>

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
2023-12-25 21:52:55 +08:00
dependabot[bot]
b03ad1c124 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-24 21:00:40 +08:00
dependabot[bot]
d398e64fcf 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-24 21:00:17 +08:00
dependabot[bot]
3710327b67 chore(deps): bump tj-actions/changed-files from 36 to 37 (#129)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-21 22:51:58 +08:00
appleboy
d47d818ab7 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 <appleboy.tw@gmail.com>
2023-07-21 22:49:16 +08:00
Luxoruus
7435be3541 docs: Adding further instructions to Windows server users (#132) 2023-07-21 22:45:39 +08:00
dependabot[bot]
11da0c97f9 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-07 11:20:18 +08:00
Ilya Brin
ec73feb854 Update README.md (#125) 2023-05-20 14:56:25 +08:00
m5chm3lz3r
cdeb36bbf9 Update README.md (#123) 2023-05-20 14:56:03 +08:00
Bo-Yi Wu
c209399d24 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
2023-04-16 12:16:16 +08:00
Bo-Yi Wu
952a6e3250 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
2023-04-16 11:44:14 +08:00
Bo-Yi Wu
82ebdbe3ed 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
2023-04-15 08:32:05 +08:00
dependabot[bot]
2cd029d317 chore(deps): bump actions/download-artifact from 2 to 3 (#109)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-11 11:05:43 +08:00
Bo-Yi.Wu
e0dbae8ff0 chore: update target field path in multiple files
- Change the `target` field value from `&#34;test&#34;` to `your_server_target_folder_path` in multiple places in the file.

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
2023-04-09 18:30:02 +08:00
Bo-Yi.Wu
3e84ad0651 chore: update GitHub Actions and dependencies
- Update the GitHub Actions `checkout` and `scp-action` versions.

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
2023-04-09 18:28:00 +08:00
Bo-Yi Wu
8a92fcdb1e chore: upgrade drone-scp to v1.6.7 version. (#101)
Some checks failed
scp files / test scp action (push) Failing after 2s
scp files / deploy artifact (push) Failing after 5s
scp files / test changed-files (push) Failing after 9s
2023-04-09 18:26:09 +08:00
Bo-Yi Wu
6cd4f0cace 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
2023-04-09 18:10:17 +08:00
Bo-Yi Wu
43abfa778d 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
2023-04-09 17:13:24 +08:00
Bo-Yi Wu
c8e0cef94a 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
2023-04-09 16:49:19 +08:00
Bo-Yi.Wu
d47875703f 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 <appleboy.tw@gmail.com>
2023-04-09 16:38:43 +08:00
Bo-Yi.Wu
a4e63f0f1a docs: add README configuration for custom file exclusions
- Add configuration example for excluding custom files in README.md

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
2023-04-09 16:10:11 +08:00
Bo-Yi.Wu
7cc0f645c7 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 <appleboy.tw@gmail.com>
2023-04-09 15:55:16 +08:00
Bo-Yi.Wu
dcb457bb6f chore: add option to dereference symlinks in tar command
- Add a flag to use `--dereference` with tar command

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
2023-04-09 15:53:02 +08:00
Bo-Yi.Wu
11c56b52d3 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 <appleboy.tw@gmail.com>
2023-04-09 15:53:02 +08:00
Bo-Yi Wu
51b937b31f 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
2023-04-09 11:57:45 +08:00
Bo-Yi Wu
98930d398c docs: fix format
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2022-07-30 10:29:28 +08:00
Bo-Yi Wu
9ec0623f29 docs: fix format
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2022-07-30 10:28:44 +08:00
Bo-Yi Wu
7f8a7c1019 docs: add new section: Setting up a SSH Key
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2022-07-30 10:23:52 +08:00
Bo-Yi Wu
2ce642f289 chore: enable funding button 2022-06-15 22:13:32 +08:00
dependabot[bot]
6291b9e86b chore(deps): bump actions/checkout from 1 to 3 (#81)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-15 22:11:02 +08:00
Bo-Yi Wu
6d1fc191a8 chore: add dependabot
Some checks failed
scp files / Build (push) Failing after 2s
2022-06-15 22:08:26 +08:00
Bo-Yi Wu
233f762873 fix(ssh): OpenSSH 8.8+ RSA keys incompatibility
See: https://github.com/appleboy/drone-scp/issues/130
2022-06-15 22:06:41 +08:00
Bo-Yi Wu
b3f8d37ead Update README.md 2022-02-24 11:13:59 +08:00
Bo-Yi Wu
f57f59fba9 chore(drone-scp): upgrade to 1.6.3
Some checks failed
scp files / Build (push) Failing after 2s
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-10-23 18:49:52 +08:00
Bo-Yi Wu
8a54b39459 chore: replace ADD with COPY 2021-02-13 10:57:10 +08:00
Dan Tsekhanskiy
eb319b796f Minor typo/grammar fixes (#48)
Thanks for making this action! Noticed a few grammar/typos when going through the README.
2021-02-01 11:41:29 +08:00
Bjørn Wikkeling
3c3575eb49 fixed typo (#44) 2020-12-26 06:35:19 +08:00
Bo-Yi Wu
edc8ec9139 chore: bump drone-scp to v1.6.2
Some checks failed
scp files / Build (push) Failing after 2s
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-06-15 16:04:17 +08:00
Bo-Yi Wu
167d6d7ff4 try the latest version
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-06-15 16:00:17 +08:00
Bo-Yi Wu
ecd6a3623b Create .env 2020-06-15 15:33:59 +08:00
Bo-Yi Wu
31b514c281 fix typo 2020-06-05 09:06:01 +08:00
Bo-Yi Wu
5924b2b6d4 Merge pull request #25 from appleboy/use_insecure_cipher
Some checks failed
scp files / Build (push) Failing after 2s
2020-05-24 14:33:16 +08:00
Bo-Yi Wu
a2fea1040d chore: bump drone-scp to v1.6.1 2020-05-24 14:26:07 +08:00
Bo-Yi Wu
8535291767 chore: add use insecure cipher flag
fix server offered: [diffie-hellman-group-exchange-sha256] error

See https://github.com/appleboy/scp-action/issues/15
2020-05-24 14:24:45 +08:00
Bo-Yi Wu
faff4f4218 chore: bump drone-scp to 1.6.0
Some checks failed
scp files / Build (push) Failing after 2s
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-22 09:47:12 +08:00
Bo-Yi Wu
ddd9176502 remove unused flag
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-22 09:45:56 +08:00
Bo-Yi Wu
326e14ddd1 docs: add fingerprint flag
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-22 09:44:56 +08:00
Bo-Yi Wu
0329cffdaa chore: remove fail job 2020-05-22 00:47:08 +08:00
Bo-Yi Wu
6df9245376 chore: add debug 2020-05-21 23:33:05 +08:00
Bo-Yi Wu
4df1959b05 chore: add debug 2020-05-21 23:30:27 +08:00
Bo-Yi Wu
1c43a9662a chore: test 2020-05-21 23:24:36 +08:00
Bo-Yi Wu
2949c755a2 Merge pull request #22 from appleboy/docs 2020-05-08 19:04:41 +08:00
Bo-Yi Wu
aefa39daef chore: Add limitation in readme 2020-05-08 19:04:16 +08:00
Bo-Yi Wu
2305e4000a upgrade drone-scp to 1.5.9
Some checks failed
scp files / Build (push) Failing after 17s
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-05 09:54:11 +08:00
Bo-Yi Wu
c51573a06a upgrade drone-scp to 1.5.8
Some checks failed
scp files / Build (push) Failing after 2s
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-04 12:44:33 +08:00
Bo-Yi Wu
d068cd7f84 Merge pull request #20 from appleboy/docs 2020-05-04 09:16:53 +08:00
Bo-Yi Wu
8ba3cfe760 docs: use with instead of env
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-04 09:12:47 +08:00
Bo-Yi Wu
1a6b426141 chore: upgrade drone-scp to 1.5.7
Some checks failed
scp files / Build (push) Failing after 2s
2020-04-16 22:25:52 +08:00
Bo-Yi Wu
8b3eebcc8d Merge pull request #11 from dbingham/fixTypo
Some checks failed
scp files / Build (push) Failing after 2s
Update to drone-scp 1.5.6
2020-02-27 11:19:51 +08:00
Daniel Bingham
861f2e0e7b Update to drone-scp 1.5.6
To pull in the fix for the typo related to proxy_paraphrase
2020-02-26 18:19:00 -08:00
Bo-Yi Wu
6971270956 Add rm default value. 2020-02-25 23:47:04 +08:00
Bo-Yi Wu
bac6c9e026 update rm default value 2020-02-25 23:46:08 +08:00
Bo-Yi Wu
b04405242e chore: improve ci workflow 2020-02-14 00:49:23 +08:00
Bo-Yi Wu
5cb36bda99 chore: add proxy setting
Some checks failed
scp files / Build (push) Failing after 37s
2020-01-20 23:08:15 +08:00
Bo-Yi Wu
6c5771fab8 chore: Add passphrase 2020-01-20 23:07:25 +08:00
Bo-Yi Wu
193fd4eaa9 chore: add passphrase testing 2020-01-20 22:51:17 +08:00
Bo-Yi Wu
a5de8af6d5 chore: update default timeout to 10 minutes
Some checks failed
scp files / Build (push) Failing after 12s
2019-11-30 23:17:05 +08:00
Bo-Yi Wu
671c934c80 Update README.md 2019-09-30 21:52:10 +08:00
Bo-Yi Wu
8da6e3d335 update docs
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-30 16:59:44 +08:00
Bo-Yi Wu
196ea3f88f chore(scp): default port is 22
Some checks failed
scp files / Build (push) Failing after 11s
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-09-30 16:58:33 +08:00
Bo-Yi Wu
034b0ad00c Update README.md 2019-09-30 11:38:02 +08:00
Bo-Yi Wu
95e250284b docs: update readme 2019-09-29 14:16:22 +08:00
Bo-Yi Wu
a593d18cb8 docs: add default value of timeout 2019-09-29 01:45:56 +08:00
13 changed files with 704 additions and 152 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@@ -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']

10
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly

View File

@@ -1,39 +1,150 @@
name: scp files
on: [push]
jobs:
build:
name: Build
testing:
name: test scp action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: "tests/a.txt,tests/b.txt"
target: "test"
- name: checkout
uses: actions/checkout@v4
- name: copy file via ssh key
uses: appleboy/scp-action@master
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 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: remove the specified number of leading path elements
uses: appleboy/scp-action@master
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: 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: 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
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: ./
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: ./
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: ./
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: ./
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

33
.github/workflows/goreleaser.yml vendored Normal file
View File

@@ -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 }}

28
.goreleaser.yaml Normal file
View File

@@ -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

View File

@@ -1,5 +0,0 @@
FROM appleboy/drone-scp:1.5.3-linux-amd64
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

384
README.md
View File

@@ -1,135 +1,345 @@
# 🚀 SCP for GitHub Actions
[GitHub Action](https://developer.github.com/actions/) for copying files and artifacts via SSH.
![ssh key](./images/copy-multiple-file.png)
[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)
## Usage
> **Note:** Only supports **Linux** [docker](https://www.docker.com/) containers.
copy files and artifacts via SSH as blow.
---
## ✨ 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: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: "tests/a.txt,tests/b.txt"
target: "test"
name: scp files
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy files via 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
```
## Input variables
---
see the [action.yml](./action.yml) file for more detail imformation.
## ⚙️ Configuration
* host - scp remote host
* port - scp remote port
* username - scp username
* password - scp password
* timeout - timeout for ssh to remote host
* command_timeout - timeout for scp command
* 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
* rm - remove target folder before upload data
* 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
### 🔌 Connection Settings
### Example
| 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 | |
Copy file via ssh password
### 📁 File Transfer Settings
| 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 | - | |
### 🌐 Proxy Settings
| 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 | |
---
## 🛡️ Best Practices & Security
- **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.
---
## 🖥️ Cross-Platform Notes
| 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 |
> 🚩 **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
---
## 💡 Usage Examples
### 🧩 Scenario Guide
- **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)
---
#### Example 1: Basic SSH Password
```yaml
- name: copy file via ssh password
uses: appleboy/scp-action@master
- name: Copy file via SSH password
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: "test"
target: your_server_target_folder_path
```
Copy file via ssh key
#### Example 2: Multi-server
```yaml
- name: copy file via ssh key
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.KEY }}
- name: Copy to multiple servers
uses: appleboy/scp-action@v0.1.7
with:
source: "tests/a.txt,tests/b.txt"
target: "test"
```
Example configuration for ignore list:
```yaml
- name: copy file via ssh key
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.KEY }}
with:
source: "tests/*.txt,!tests/a.txt"
target: "test"
```
Example configuration for multiple server
```diff
- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
- host: "example.com"
+ host: "foo.com,bar.com"
host: "foo.com,bar.com"
username: foo
password: bar
port: 22
source: "tests/a.txt,tests/b.txt"
target: "test"
target: your_server_target_folder_path
```
remove the specified number of leading path elements
#### Example 3: Changed Files Only
```yaml
- name: remove the specified number of leading path elements
uses: appleboy/scp-action@master
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
with:
since_last_remote_commit: true
separator: ","
- 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"
target: "foobar"
strip_components: 1
source: ${{ steps.changed-files.outputs.all_changed_files }}
target: your_server_target_folder_path
```
old target structure:
#### Example 4: Artifacts Integration
```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: 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
```
#### Example 5: Windows Server
```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
```
---
## 🗝️ SSH Key Setup
1. **Generate SSH Key** (on your local machine):
```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
foobar
└── tests
├── a.txt
└── b.txt
CASignatureAlgorithms +ssh-rsa
```
new target structure:
Or use ed25519 keys, which are accepted by default.
```sh
foobar
├── a.txt
└── b.txt
---
## 🧰 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

View File

@@ -1,43 +1,142 @@
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: "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: "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'
default: "1m"
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: "Passphrase for the SSH private key, if required."
fingerprint:
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: "Enable additional, less secure ciphers for compatibility. Not recommended unless required."
target:
description: 'target path on the server'
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 messages for troubleshooting."
strip_components:
description: 'remove the specified number of leading path elements'
default: 0
description: "Remove the specified number of leading path elements when extracting files."
overwrite:
description: 'use `--overwrite` flag with tar'
default: false
description: "Use the --overwrite flag with tar to overwrite existing files."
tar_dereference:
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: "Path to the tar executable on the destination host. Default: tar."
default: "tar"
proxy_host:
description: "Remote host address for SSH proxy."
proxy_port:
description: "SSH proxy port. Default: 22."
default: "22"
proxy_username:
description: "Username for SSH proxy authentication."
proxy_password:
description: "Password for SSH proxy authentication."
proxy_passphrase:
description: "Passphrase for the SSH proxy private key, if required."
proxy_timeout:
description: "Timeout for establishing SSH connection to the proxy host. Default: 30s."
default: "30s"
proxy_key:
description: "Content of the SSH proxy private key (e.g., the raw content of ~/.ssh/id_rsa)."
proxy_key_path:
description: "Path to the SSH proxy private key file."
proxy_fingerprint:
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: "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"
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'
color: 'gray-dark'
icon: "copy"
color: "gray-dark"

View File

@@ -1,9 +1,56 @@
#!/bin/sh
#!/usr/bin/env bash
set -eu
set -euo pipefail
export GITHUB="true"
[ -n "$INPUT_STRIP_COMPONENTS" ] && export INPUT_STRIP_COMPONENTS=$((INPUT_STRIP_COMPONENTS + 0))
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}"
sh -c "/bin/drone-scp $*"
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<<EOF'
"${TARGET}" "$@" | tee -a "${GITHUB_OUTPUT}"
echo 'EOF'
} >>"${GITHUB_OUTPUT}"
else
"${TARGET}" "$@"
fi

View File

@@ -1 +1,2 @@
foo
foobar

View File

@@ -1 +1,2 @@
bar
foobar

View File

@@ -1 +1,3 @@
c
foobar
test1234

View File

@@ -1 +1,3 @@
d
foobar
foobar