mirror of
https://github.com/easingthemes/ssh-deploy
synced 2026-06-03 09:08:09 +08:00
Compare commits
1 Commits
v6.0.1
...
refactor/r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e75a8e721 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -20,6 +20,3 @@ node_modules/
|
|||||||
# IDE
|
# IDE
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
# AI
|
|
||||||
.claude/settings.local.json
|
|
||||||
|
|||||||
40
CLAUDE.md
40
CLAUDE.md
@@ -1,40 +0,0 @@
|
|||||||
# CLAUDE.md
|
|
||||||
|
|
||||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
||||||
|
|
||||||
## Project Overview
|
|
||||||
|
|
||||||
GitHub Action for deploying files via rsync over SSH, with optional remote script execution before/after deployment. Published as `easingthemes/ssh-deploy` on the GitHub Marketplace.
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
- **Build (lint + bundle):** `npm run build`
|
|
||||||
- **Lint only:** `npm run lint`
|
|
||||||
- **Lint with autofix:** `npm run lint:fix`
|
|
||||||
- **No unit test suite** — testing is done via e2e workflows in CI (Docker-based SSH server, see `.github/workflows/e2e.yml`)
|
|
||||||
|
|
||||||
The build step runs ESLint then bundles `src/index.js` into `dist/index.js` using `@vercel/ncc`. The `dist/index.js` is the actual entrypoint executed by GitHub Actions (defined in `action.yml`).
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
The action runs as a single Node.js 24 process with this execution flow:
|
|
||||||
|
|
||||||
1. **`src/inputs.js`** — Reads all config from environment variables (both `INPUT_*` and bare names). Converts `SNAKE_CASE` input names to `camelCase`. Splits multi-value inputs: `SOURCE` and `ARGS` on spaces, `EXCLUDE` and `SSH_CMD_ARGS` on commas. Prepends `GITHUB_WORKSPACE` to source paths. Exports a single `inputs` object used by all other modules.
|
|
||||||
|
|
||||||
2. **`src/index.js`** — Orchestration entry point. Pipeline: validate inputs → write SSH key → optionally update known_hosts → run SCRIPT_BEFORE → rsync → run SCRIPT_AFTER.
|
|
||||||
|
|
||||||
3. **`src/sshKey.js`** — Writes the SSH private key to `~/.ssh/<deploy_key_name>` with mode `0400`. Creates `known_hosts` file. Uses `ssh-keyscan` to add the remote host when before/after scripts are configured.
|
|
||||||
|
|
||||||
4. **`src/rsyncCli.js`** — Validates rsync is installed (auto-installs via apt-get if missing). Uses the local `src/rsync.js` module (child_process.spawn) to execute the rsync transfer.
|
|
||||||
|
|
||||||
5. **`src/remoteCmd.js`** — Writes script content to a temporary `.sh` file in the workspace, executes it on the remote host via `ssh ... 'bash -s' < script.sh`, then deletes the local script file. Passes `RSYNC_STDOUT` env var to after-scripts.
|
|
||||||
|
|
||||||
6. **`src/helpers.js`** — File I/O utilities (`writeToFile`, `deleteFile`), input validation, and `snakeToCamel` converter.
|
|
||||||
|
|
||||||
## Key Conventions
|
|
||||||
|
|
||||||
- **CommonJS modules** — the project uses `require`/`module.exports`, not ES modules.
|
|
||||||
- **ESLint 10 flat config** (`eslint.config.js`) — uses `@eslint/js` recommended + `@stylistic/eslint-plugin` for formatting. Notable rules: no trailing commas, `console` is allowed.
|
|
||||||
- **Semantic release** on `main` branch via `.releaserc` — use conventional commit messages (`fix:`, `feat:`, etc.). npm publish is disabled; releases are git tags + changelog only.
|
|
||||||
- **`dist/index.js` must be committed** — it's the bundled action entrypoint. Run `npm run build` and commit the updated dist after any source changes.
|
|
||||||
- **Inputs are environment variables**, not `@actions/core` — the action reads directly from `process.env` rather than using the GitHub Actions toolkit.
|
|
||||||
@@ -1,33 +1,3 @@
|
|||||||
## [6.0.1](https://github.com/easingthemes/ssh-deploy/compare/v6.0.0...v6.0.1) (2026-04-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* upgrade devDependencies and migrate to eslint 10 flat config ([c88faf5](https://github.com/easingthemes/ssh-deploy/commit/c88faf565603544c354d0d27ab6948a6d2048c40))
|
|
||||||
|
|
||||||
# [6.0.0](https://github.com/easingthemes/ssh-deploy/compare/v5.1.2...v6.0.0) (2026-04-02)
|
|
||||||
|
|
||||||
|
|
||||||
* feat!: replace rsyncwrapper with direct child_process.spawn ([b11fb7f](https://github.com/easingthemes/ssh-deploy/commit/b11fb7f9113ccfec263a5645d472d0351e4874da))
|
|
||||||
* feat!: replace rsyncwrapper with local rsync module ([71b8eb3](https://github.com/easingthemes/ssh-deploy/commit/71b8eb300f807e47a87dc96ace9e083d606c05e7))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add proc.on('error') handler to prevent hanging on spawn failure ([c81b43c](https://github.com/easingthemes/ssh-deploy/commit/c81b43c5bf3a389da4168d71e71ddf2f118c2939))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* rsyncwrapper dependency removed, rsync command is now
|
|
||||||
constructed and executed via a local module using child_process.spawn.
|
|
||||||
|
|
||||||
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
||||||
* rsyncwrapper dependency removed, rsync command is now
|
|
||||||
constructed and executed directly via child_process.spawn.
|
|
||||||
|
|
||||||
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
||||||
|
|
||||||
## [5.1.2](https://github.com/easingthemes/ssh-deploy/compare/v5.1.1...v5.1.2) (2026-04-02)
|
## [5.1.2](https://github.com/easingthemes/ssh-deploy/compare/v5.1.1...v5.1.2) (2026-04-02)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@draganfilipovic/ssh-deploy",
|
"name": "@draganfilipovic/ssh-deploy",
|
||||||
"version": "6.0.0",
|
"version": "5.1.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@draganfilipovic/ssh-deploy",
|
"name": "@draganfilipovic/ssh-deploy",
|
||||||
"version": "6.0.0",
|
"version": "5.1.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
@@ -1509,7 +1509,7 @@
|
|||||||
"levn": "^0.4.1",
|
"levn": "^0.4.1",
|
||||||
"prelude-ls": "^1.2.1",
|
"prelude-ls": "^1.2.1",
|
||||||
"type-check": "^0.4.0",
|
"type-check": "^0.4.0",
|
||||||
"word-wrap": "^1.2.5"
|
"word-wrap": "npm:@aashutoshrathi/word-wrap@1.2.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"p-limit": {
|
"p-limit": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@draganfilipovic/ssh-deploy",
|
"name": "@draganfilipovic/ssh-deploy",
|
||||||
"version": "6.0.1",
|
"version": "5.1.2",
|
||||||
"description": "Fast NodeJS action to deploy specific directory from `GITHUB_WORKSPACE` to a server via rsync over ssh.",
|
"description": "Fast NodeJS action to deploy specific directory from `GITHUB_WORKSPACE` to a server via rsync over ssh.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
Reference in New Issue
Block a user