Compare commits

...

10 Commits
v6.0.0 ... main

Author SHA1 Message Date
github-actions
2cc5b27bf3 chore(release): 6.0.3 [skip ci]
## [6.0.3](https://github.com/easingthemes/ssh-deploy/compare/v6.0.2...v6.0.3) (2026-04-02)

### Bug Fixes

* keep @semantic-release/github plugin for GitHub Releases ([0cffff4](0cffff4878))
* update major version tag as post-release step ([6306dda](6306ddad7c))
2026-04-02 21:50:15 +00:00
Dragan Filipović
066a59ba0d Merge pull request #213 from easingthemes/fix/update-major-tag-on-release
fix: update major version tag as post-release step
2026-04-02 23:49:42 +02:00
Dragan Filipovic
0cffff4878 fix: keep @semantic-release/github plugin for GitHub Releases
This plugin creates proper GitHub Release pages with changelogs,
which is valuable independently of workflow triggering.
2026-04-02 23:48:36 +02:00
Dragan Filipovic
6306ddad7c fix: update major version tag as post-release step
Move major tag update (e.g. v6) into the release workflow as a
conditional step, gated on semantic-release actually publishing.
This avoids the GITHUB_TOKEN limitation where events from the
default token don't trigger separate workflows.

Also reverts @semantic-release/github from .releaserc since we no
longer rely on the release event to trigger a separate workflow.
2026-04-02 23:47:01 +02:00
github-actions
ffb309fccf chore(release): 6.0.2 [skip ci]
## [6.0.2](https://github.com/easingthemes/ssh-deploy/compare/v6.0.1...v6.0.2) (2026-04-02)

### Bug Fixes

* add @semantic-release/github plugin to create GitHub Releases ([9e4918b](9e4918b4e1))
2026-04-02 21:41:16 +00:00
Dragan Filipović
0f3da31792 Merge pull request #212 from easingthemes/fix/add-github-release-plugin
fix: add @semantic-release/github plugin to create GitHub Releases
2026-04-02 23:40:48 +02:00
Dragan Filipovic
9e4918b4e1 fix: add @semantic-release/github plugin to create GitHub Releases
The update-major-tag workflow triggers on `release: published`, but
semantic-release was only creating git tags (via @semantic-release/git)
without creating actual GitHub Release objects. This meant the workflow
never fired.
2026-04-02 23:40:00 +02:00
github-actions
5d8aeab1a5 chore(release): 6.0.1 [skip ci]
## [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](c88faf5656))
2026-04-02 21:32:53 +00:00
Dragan Filipović
0f723444d0 Merge pull request #211 from easingthemes/chore/upgrade-devdeps-eslint10
chore: upgrade devDependencies and migrate to eslint 10 flat config
2026-04-02 23:32:28 +02:00
Dragan Filipovic
c88faf5656 fix: upgrade devDependencies and migrate to eslint 10 flat config
- Upgrade eslint 8.31 → 10.1 with new flat config (eslint.config.js)
- Upgrade @vercel/ncc 0.36 → 0.38.4
- Replace eslint-config-airbnb-base + eslint-plugin-import with @eslint/js + @stylistic/eslint-plugin
- Remove stale overrides in package.json (word-wrap, semver)
- Remove obsolete eslint-disable comments from source files
- Add { cause } to rethrown error in rsyncCli.js
- Add .gitignore and CLAUDE.md
- Resolves all 3 npm audit vulnerabilities (flatted, minimatch, js-yaml)
2026-04-02 23:31:02 +02:00
15 changed files with 826 additions and 2563 deletions

View File

@@ -1,25 +0,0 @@
module.exports = {
env: {
commonjs: true,
es6: true,
node: true
},
extends: [
'airbnb-base'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaVersion: 2018
},
rules: {
'comma-dangle': [
'error',
'never'
],
'no-console': 'off',
'object-curly-newline': 'off'
}
};

View File

@@ -28,6 +28,7 @@ jobs:
- name: Run Tests
run: npm test --if-present
- name: Release
id: semantic
uses: cycjimmy/semantic-release-action@v6
with:
semantic_version: 24
@@ -43,3 +44,11 @@ jobs:
GIT_COMMITTER_NAME: github-actions
GIT_COMMITTER_EMAIL: github-actions@github.com
CI: true
- name: Update major version tag
if: steps.semantic.outputs.new_release_published == 'true'
run: |
MAJOR="v${{ steps.semantic.outputs.new_release_major_version }}"
TAG="v${{ steps.semantic.outputs.new_release_version }}"
echo "Updating $MAJOR tag to point to $TAG"
git tag -f "$MAJOR" "$TAG"
git push -f origin "$MAJOR"

View File

@@ -1,23 +0,0 @@
name: Update major version tag
on:
release:
types: [published]
jobs:
update-tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Update major version tag
run: |
VERSION="${{ github.event.release.tag_name }}"
MAJOR="v$(echo "$VERSION" | sed 's/^v//' | cut -d. -f1)"
echo "Updating $MAJOR tag to point to $VERSION"
git tag -f "$MAJOR" "$VERSION"
git push -f origin "$MAJOR"

3
.gitignore vendored
View File

@@ -20,3 +20,6 @@ node_modules/
# IDE
.idea
.vscode
# AI
.claude/settings.local.json

View File

@@ -17,6 +17,7 @@
{
"assets": ["docs/CHANGELOG.md", "package.json"]
}
]
],
"@semantic-release/github"
]
}

40
CLAUDE.md Normal file
View File

@@ -0,0 +1,40 @@
# 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.

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,25 @@
## [6.0.3](https://github.com/easingthemes/ssh-deploy/compare/v6.0.2...v6.0.3) (2026-04-02)
### Bug Fixes
* keep @semantic-release/github plugin for GitHub Releases ([0cffff4](https://github.com/easingthemes/ssh-deploy/commit/0cffff4878a082b939d7fa0db84034a64b498430))
* update major version tag as post-release step ([6306dda](https://github.com/easingthemes/ssh-deploy/commit/6306ddad7ccb78a18c3a18668fbb0b9b0adb911f))
## [6.0.2](https://github.com/easingthemes/ssh-deploy/compare/v6.0.1...v6.0.2) (2026-04-02)
### Bug Fixes
* add @semantic-release/github plugin to create GitHub Releases ([9e4918b](https://github.com/easingthemes/ssh-deploy/commit/9e4918b4e1c18dfdf7b93e70301baaefeb15bab3))
## [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)

52
eslint.config.js Normal file
View File

@@ -0,0 +1,52 @@
const js = require('@eslint/js');
const stylistic = require('@stylistic/eslint-plugin');
const globals = require('globals');
module.exports = [
js.configs.recommended,
{
plugins: {
'@stylistic': stylistic
},
languageOptions: {
ecmaVersion: 2020,
sourceType: 'commonjs',
globals: {
...globals.node,
...globals.commonjs,
...globals.es2020,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
}
},
rules: {
// Stylistic rules (migrated from airbnb-base)
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/indent': ['error', 2, { SwitchCase: 1 }],
'@stylistic/semi': ['error', 'always'],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/arrow-parens': ['error', 'always'],
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
'@stylistic/eol-last': ['error', 'always'],
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/space-before-blocks': 'error',
'@stylistic/space-infix-ops': 'error',
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
// JS rules (migrated from airbnb-base)
'no-console': 'off',
'no-var': 'error',
'prefer-const': 'error',
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
'object-shorthand': ['error', 'always'],
'no-shadow': 'error',
'no-use-before-define': ['error', { functions: true, classes: true, variables: true }],
'camelcase': ['error', { properties: 'never' }],
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }]
}
}
];

3189
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@draganfilipovic/ssh-deploy",
"version": "6.0.0",
"version": "6.0.3",
"description": "Fast NodeJS action to deploy specific directory from `GITHUB_WORKSPACE` to a server via rsync over ssh.",
"main": "dist/index.js",
"files": [
@@ -30,13 +30,10 @@
},
"homepage": "https://github.com/easingthemes/ssh-deploy#readme",
"devDependencies": {
"@vercel/ncc": "^0.36.0",
"eslint": "^8.30.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0"
},
"overrides": {
"word-wrap": "npm:@aashutoshrathi/word-wrap@1.2.5",
"semver": "^7.5.2"
"@eslint/js": "^10.0.1",
"@stylistic/eslint-plugin": "^5.10.0",
"@vercel/ncc": "^0.38.4",
"eslint": "^10.1.0",
"globals": "^17.4.0"
}
}

View File

@@ -27,7 +27,6 @@ const run = async () => {
if (scriptBefore) {
await remoteCmdBefore(scriptBefore, privateKeyPath, scriptBeforeRequired);
}
/* eslint-disable object-property-newline */
await sshDeploy({
source, rsyncServer, exclude, remotePort,
privateKeyPath, args, sshCmdArgs

View File

@@ -27,7 +27,6 @@ inputNames.forEach((input) => {
const inputVal = process.env[input] || process.env[`INPUT_${input}`] || defaultInputs[inputName];
const validVal = inputVal === undefined ? defaultInputs[inputName] : inputVal;
let extendedVal = validVal;
// eslint-disable-next-line default-case
switch (inputName) {
case 'source':
extendedVal = validVal.split(' ').map((src) => `${githubWorkspace}/${src}`);

View File

@@ -11,7 +11,6 @@ const handleError = (message, isRequired, callback) => {
}
};
// eslint-disable-next-line max-len
const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Promise((resolve, reject) => {
const uuid = crypto.randomUUID();
const filename = `local_ssh_script-${label}-${uuid}.sh`;

View File

@@ -46,7 +46,7 @@ const validateRsync = async () => {
execSync('sudo DEBIAN_FRONTEND=noninteractive apt-get -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install rsync', { stdio: 'inherit' });
console.log('✅ [CLI] Rsync installed. \n');
} catch (error) {
throw new Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${error.message}`);
throw new Error(`⚠️ [CLI] Rsync installation failed. Aborting ... error: ${error.message}`, { cause: error });
}
};
@@ -65,7 +65,6 @@ const rsyncCli = async ({
};
// RSYNC COMMAND
/* eslint-disable object-property-newline */
return nodeRsyncPromise({
...defaultOptions,
src: source, dest: rsyncServer, excludeFirst: exclude, port: remotePort,