Compare commits

...

62 Commits

Author SHA1 Message Date
github-actions
c711f2c339 chore(release): 2.2.11 [skip ci]
## [2.2.11](https://github.com/easingthemes/ssh-deploy/compare/v2.2.10...v2.2.11) (2021-05-28)

### Bug Fixes

* remove change npm to public ([3c36af7](3c36af7577))
2021-05-28 00:23:46 +00:00
Dragan Filipović
824072bc5a Merge pull request #60 from easingthemes/feature/package-json-automation-6
fix: remove change npm to public
2021-05-28 02:22:56 +02:00
Dragan Filipovic
3c36af7577 fix: remove change npm to public 2021-05-28 02:22:36 +02:00
github-actions
649339f4bb chore(release): 2.2.10 [skip ci]
## [2.2.10](https://github.com/easingthemes/ssh-deploy/compare/v2.2.9...v2.2.10) (2021-05-27)

### Bug Fixes

* add assets to semantic-release git ([0867b12](0867b12954))
2021-05-27 23:24:30 +00:00
Dragan Filipović
66e6843055 Merge pull request #59 from easingthemes/feature/package-json-automation-5
fix: add assets to semantic-release git
2021-05-28 01:23:43 +02:00
Dragan Filipovic
0867b12954 fix: add assets to semantic-release git 2021-05-28 01:23:17 +02:00
github-actions
d71ce0f0b2 chore(release): 2.2.9 [skip ci]
## [2.2.9](https://github.com/easingthemes/ssh-deploy/compare/v2.2.8...v2.2.9) (2021-05-27)

### Bug Fixes

* change npm to public ([191c82d](191c82d9b4))
2021-05-27 22:38:16 +00:00
Dragan Filipović
382db98e53 Merge pull request #58 from easingthemes/feature/package-json-automation-4
fix: change npm to public
2021-05-28 00:37:29 +02:00
Dragan Filipovic
191c82d9b4 fix: change npm to public 2021-05-28 00:37:06 +02:00
github-actions
5109c975e9 chore(release): 2.2.8 [skip ci]
## [2.2.8](https://github.com/easingthemes/ssh-deploy/compare/v2.2.7...v2.2.8) (2021-05-27)

### Bug Fixes

* update npm package name ([9c4e411](9c4e4119ad))
2021-05-27 22:33:51 +00:00
Dragan Filipović
76882263e5 Merge pull request #57 from easingthemes/feature/package-json-automation-3
fix: update npm package name
2021-05-28 00:33:13 +02:00
Dragan Filipovic
9c4e4119ad fix: update npm package name 2021-05-28 00:32:37 +02:00
github-actions
fbeaefca08 chore(release): 2.2.7 [skip ci]
## [2.2.7](https://github.com/easingthemes/ssh-deploy/compare/v2.2.6...v2.2.7) (2021-05-27)

### Bug Fixes

* minify dist ([87551c3](87551c3893))
2021-05-27 22:24:50 +00:00
Dragan Filipović
f04642c1f5 Merge pull request #56 from easingthemes/feature/package-json-automation-2
Feature/package json automation 2
2021-05-28 00:24:06 +02:00
Dragan Filipovic
fdf6057d5e ci: try package.json npm enabled 2021-05-28 00:23:28 +02:00
Dragan Filipovic
87551c3893 fix: minify dist 2021-05-28 00:23:04 +02:00
github-actions
83d848a9e4 chore(release): 2.2.6 [skip ci]
## [2.2.6](https://github.com/easingthemes/ssh-deploy/compare/v2.2.5...v2.2.6) (2021-05-27)

### Bug Fixes

* add NPM token ([2197bc6](2197bc60ef))
2021-05-27 22:02:20 +00:00
Dragan Filipović
9c02ed6208 Merge pull request #55 from easingthemes/feature/package-json-automation-1
fix: add NPM token
2021-05-28 00:01:28 +02:00
Dragan Filipovic
2197bc60ef fix: add NPM token 2021-05-27 23:57:27 +02:00
github-actions
eb4a19604b chore(release): 2.2.5 [skip ci]
## [2.2.5](https://github.com/easingthemes/ssh-deploy/compare/v2.2.4...v2.2.5) (2021-05-27)

### Bug Fixes

* semantic-release/npm update config ([40096bf](40096bf224))
2021-05-27 21:40:47 +00:00
Dragan Filipović
09342ca039 Merge pull request #54 from easingthemes/feature/package-json-automation
fix: semantic-release/npm update config
2021-05-27 23:40:02 +02:00
Dragan Filipovic
40096bf224 fix: semantic-release/npm update config 2021-05-27 23:39:43 +02:00
github-actions
4383250122 chore(release): 2.2.4 [skip ci]
## [2.2.4](https://github.com/easingthemes/ssh-deploy/compare/v2.2.3...v2.2.4) (2021-05-27)

### Bug Fixes

* add branch instead of a version in a readme ([8218c8e](8218c8ed95))
2021-05-27 21:35:25 +00:00
Dragan Filipović
142b71c9e1 Merge pull request #53 from easingthemes/feature/readme-update
fix: add branch instead of a version in a readme
2021-05-27 23:34:31 +02:00
Dragan Filipovic
8218c8ed95 fix: add branch instead of a version in a readme 2021-05-27 23:33:55 +02:00
github-actions
b75a6aac49 chore(release): 2.2.3 [skip ci]
## [2.2.3](https://github.com/easingthemes/ssh-deploy/compare/v2.2.2...v2.2.3) (2021-05-27)

### Bug Fixes

* codeql yaml syntax update ([87ad671](87ad6713b5))
2021-05-27 21:20:23 +00:00
Dragan Filipović
a0be71d296 Merge pull request #52 from easingthemes/feature/codeql-fix
fix: codeql yaml syntax update
2021-05-27 23:19:39 +02:00
Dragan Filipovic
87ad6713b5 fix: codeql yaml syntax update 2021-05-27 23:16:38 +02:00
github-actions
b12dcbe93c chore(release): 2.2.2 [skip ci]
## [2.2.2](https://github.com/easingthemes/ssh-deploy/compare/v2.2.1...v2.2.2) (2021-05-27)

### Bug Fixes

* codeql build ([5e456a4](5e456a475a))
2021-05-27 21:14:04 +00:00
Dragan Filipović
c984a47bf5 Merge pull request #51 from easingthemes/feature/codeql-fix
fix: codeql build
2021-05-27 23:13:23 +02:00
Dragan Filipovic
5e456a475a fix: codeql build 2021-05-27 23:12:03 +02:00
github-actions
a9eda89ad7 chore(release): 2.2.1 [skip ci]
## [2.2.1](https://github.com/easingthemes/ssh-deploy/compare/v2.2.0...v2.2.1) (2021-05-27)

### Bug Fixes

* add package json auto updates ([ce56d75](ce56d75fc1))
2021-05-27 21:08:10 +00:00
Dragan Filipović
3cfa1cdc25 Merge pull request #50 from easingthemes/feature/release-npm-update
fix: add package json auto updates
2021-05-27 23:07:30 +02:00
Dragan Filipovic
ce56d75fc1 fix: add package json auto updates 2021-05-27 23:06:40 +02:00
github-actions
74b3a2aba4 chore(release): 2.2.0 [skip ci]
# [2.2.0](https://github.com/easingthemes/ssh-deploy/compare/v2.1.7...v2.2.0) (2021-05-27)

### Bug Fixes

* only=prod package json ([95f4dc8](95f4dc8069))
* replace i with ci ([50d1f57](50d1f576f9))
* update ncc ([20a0cae](20a0cae1ae))
* update plugins ([b2adc00](b2adc00c92))
* update plugins ([a50a999](a50a999528))

### Features

* add semantic-release-action ([ac3c9b5](ac3c9b51d5))
2021-05-27 21:00:10 +00:00
Dragan Filipović
77bfc8c169 Merge pull request #49 from easingthemes/feature/release-ci-update
feat: add semantic-release-action
2021-05-27 22:59:32 +02:00
Dragan Filipovic
ac3c9b51d5 feat: add semantic-release-action 2021-05-27 22:56:27 +02:00
Dragan Filipović
a0be893c82 Merge pull request #48 from easingthemes/feature/dependencies-update
Feature/dependencies update
2021-05-27 22:38:28 +02:00
Dragan Filipovic
50d1f576f9 fix: replace i with ci 2021-05-27 22:08:42 +02:00
Dragan Filipovic
20a0cae1ae fix: update ncc 2021-05-27 22:04:06 +02:00
Dragan Filipovic
95f4dc8069 fix: only=prod package json 2021-05-27 22:03:15 +02:00
Dragan Filipovic
b2adc00c92 fix: update plugins 2021-05-27 21:51:19 +02:00
Dragan Filipovic
a50a999528 fix: update plugins 2021-05-27 21:51:10 +02:00
github-actions
1242867d7a 2.1.9 2021-04-16 23:24:55 +00:00
Dragan Filipovic
33648ba2ca CI - test tags 2021-04-17 01:03:01 +02:00
github-actions
40a3789c05 2.1.8 2021-04-16 22:56:33 +00:00
github-actions
7e2c0f29d6 2.1.7 2021-04-16 22:41:08 +00:00
Dragan Filipovic
e9c43c6900 CI - use ci instead of install 2021-04-17 00:39:39 +02:00
Dragan Filipovic
9ae3c340cb CI add git user data 2021-04-17 00:36:22 +02:00
Dragan Filipovic
386c8766a0 CI - split git commands 2021-04-17 00:28:36 +02:00
Dragan Filipovic
130901534a CI - typo fix 2021-04-17 00:24:54 +02:00
Dragan Filipovic
8b977327bb CI - split git commands 2021-04-17 00:22:34 +02:00
Dragan Filipović
880f3b6b88 Merge pull request #43 from easingthemes/feature/CI-add-tag-action
Feature/ci add tag action
2021-04-17 00:18:03 +02:00
Dragan Filipovic
ec4a00fe02 CI - typo fix 2021-04-17 00:17:27 +02:00
Dragan Filipovic
a04c641775 CI - add steps names 2021-04-17 00:12:22 +02:00
Dragan Filipovic
9483c83d88 CI fix input vars 2021-04-17 00:08:19 +02:00
Dragan Filipovic
e41d593e15 CI add actions for build and tag 2021-04-17 00:06:00 +02:00
Dragan Filipović
9ab3993555 Merge pull request #35 from easingthemes/feature/RSYNC-exclude-option
RSYNC use excludeFirst instead of exclude
2021-03-24 18:50:40 +01:00
Dragan Filipovic
07265c8c95 RSYNC use excludeFirst instead of exclude 2021-03-24 18:48:12 +01:00
Dragan Filipović
a27b8667de Merge pull request #32 from peterkracik/master
Exclude folder parameter
2021-03-15 09:54:06 +01:00
Peter Kracik
2b38f7bf7a Added exclude parameter 2021-03-12 07:42:12 +01:00
Peter Kracik
cd3b869a28 Update action.yml 2021-03-12 07:26:41 +01:00
13 changed files with 1033 additions and 1477 deletions

31
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: Build
on:
push:
branches: [ '**' ]
pull_request:
branches: [ $default-branch ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Build Library
run: npm run build
- name: Run Tests
run: npm test --if-present

47
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '20 12 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
steps:
- name: Checkout
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- run: |
npm ci
npm run build --if-present
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

44
.github/workflows/manual-release.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Manual Release
on:
workflow_dispatch:
inputs:
dryrun:
description: 'DryRUn'
required: true
default: 'false'
jobs:
release:
name: Test, Build and Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [ 14.x ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix['node-version'] }}
- name: Install dependencies
run: npm ci
- name: Build Library
run: npm run build --if-present
- name: Run Tests
run: npm test --if-present
- name: Release
uses: cycjimmy/semantic-release-action@v2
with:
dry_run: ${{ github.event.inputs.dryrun == 'true' }}
extra_plugins: |
@semantic-release/changelog@3.0.0
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: github-actions
GIT_AUTHOR_EMAIL: github-actions@github.com
GIT_COMMITTER_NAME: github-actions
GIT_COMMITTER_EMAIL: github-actions@github.com
CI: true

44
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Test, Build and Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [ 14.x ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix['node-version'] }}
- name: Install dependencies
run: npm ci
- name: Build Library
run: npm run build --if-present
- name: Run Tests
run: npm test --if-present
- name: Release
uses: cycjimmy/semantic-release-action@v2
with:
dry_run: false
extra_plugins: |
@semantic-release/changelog@3.0.0
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: github-actions
GIT_AUTHOR_EMAIL: github-actions@github.com
GIT_COMMITTER_NAME: github-actions
GIT_COMMITTER_EMAIL: github-actions@github.com
CI: true

22
.releaserc Normal file
View File

@@ -0,0 +1,22 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "docs/CHANGELOG.md"
}
],
["@semantic-release/npm", {
"npmPublish": false
}],
[
"@semantic-release/git",
{
"assets": ["docs/CHANGELOG.md", "package.json"]
}
]
]
}

View File

@@ -49,13 +49,18 @@ The source directory, path relative to `$GITHUB_WORKSPACE` root, eg: `dist/`
The target directory
##### 8. `EXCLUDE` (optional, default '')
path to exclude separated by `,`, ie: `/dist/, /node_modules/`
# Usage
!!! Please use latest version, Readme file is just an example, eg: ssh-deploy@v2.1.5
Use the latest version from Marketplace,eg: ssh-deploy@v2
or use the latest version from a branch, eg: ssh-deploy@main
```
- name: Deploy to Staging server
uses: easingthemes/ssh-deploy@v2.1.5
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO"
@@ -63,6 +68,7 @@ The target directory
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_TARGET }}
EXCLUDE: "/dist/, /node_modules/"
```
# Example usage in workflow
@@ -88,7 +94,7 @@ jobs:
- name: Run build task
run: npm run build --if-present
- name: Deploy to Server
uses: easingthemes/ssh-deploy@v2.1.5
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO --delete"
@@ -96,6 +102,7 @@ jobs:
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: ${{ secrets.REMOTE_TARGET }}
EXCLUDE: "/dist/, /node_modules/"
```
## Disclaimer

View File

@@ -27,6 +27,10 @@ inputs:
description: "Arguments to pass to rsync"
required: false
default: "-rltgoDzvO"
EXCLUDE:
description: "An array of folder to exclude"
required: false
default: ""
outputs:
status:
description: "Status"

730
dist/index.js vendored

File diff suppressed because one or more lines are too long

92
docs/CHANGELOG.md Normal file
View File

@@ -0,0 +1,92 @@
## [2.2.11](https://github.com/easingthemes/ssh-deploy/compare/v2.2.10...v2.2.11) (2021-05-28)
### Bug Fixes
* remove change npm to public ([3c36af7](https://github.com/easingthemes/ssh-deploy/commit/3c36af7577e5aee231cea5a01bb6cc83717d0e74))
## [2.2.10](https://github.com/easingthemes/ssh-deploy/compare/v2.2.9...v2.2.10) (2021-05-27)
### Bug Fixes
* add assets to semantic-release git ([0867b12](https://github.com/easingthemes/ssh-deploy/commit/0867b12954dee2b8a2cccb7dfea3b8f3aa62d679))
## [2.2.9](https://github.com/easingthemes/ssh-deploy/compare/v2.2.8...v2.2.9) (2021-05-27)
### Bug Fixes
* change npm to public ([191c82d](https://github.com/easingthemes/ssh-deploy/commit/191c82d9b441e26cf43f81041376dbf5ecdc1647))
## [2.2.8](https://github.com/easingthemes/ssh-deploy/compare/v2.2.7...v2.2.8) (2021-05-27)
### Bug Fixes
* update npm package name ([9c4e411](https://github.com/easingthemes/ssh-deploy/commit/9c4e4119ad64792e5435e4dbe574c56a3e70839c))
## [2.2.7](https://github.com/easingthemes/ssh-deploy/compare/v2.2.6...v2.2.7) (2021-05-27)
### Bug Fixes
* minify dist ([87551c3](https://github.com/easingthemes/ssh-deploy/commit/87551c38936fc91c0fbe3346ca43319d8098ac09))
## [2.2.6](https://github.com/easingthemes/ssh-deploy/compare/v2.2.5...v2.2.6) (2021-05-27)
### Bug Fixes
* add NPM token ([2197bc6](https://github.com/easingthemes/ssh-deploy/commit/2197bc60ef7870d4bd494966b314eabec1615bd7))
## [2.2.5](https://github.com/easingthemes/ssh-deploy/compare/v2.2.4...v2.2.5) (2021-05-27)
### Bug Fixes
* semantic-release/npm update config ([40096bf](https://github.com/easingthemes/ssh-deploy/commit/40096bf22459d1dd82172d2bd20c0c149e70b1e1))
## [2.2.4](https://github.com/easingthemes/ssh-deploy/compare/v2.2.3...v2.2.4) (2021-05-27)
### Bug Fixes
* add branch instead of a version in a readme ([8218c8e](https://github.com/easingthemes/ssh-deploy/commit/8218c8ed9514d772933e1ab4d1c725a7c05e149f))
## [2.2.3](https://github.com/easingthemes/ssh-deploy/compare/v2.2.2...v2.2.3) (2021-05-27)
### Bug Fixes
* codeql yaml syntax update ([87ad671](https://github.com/easingthemes/ssh-deploy/commit/87ad6713b53d454bd7ad6c4576cea7b2e3e2f4f3))
## [2.2.2](https://github.com/easingthemes/ssh-deploy/compare/v2.2.1...v2.2.2) (2021-05-27)
### Bug Fixes
* codeql build ([5e456a4](https://github.com/easingthemes/ssh-deploy/commit/5e456a475a15096d08ccd2aff2734b3f1250b308))
## [2.2.1](https://github.com/easingthemes/ssh-deploy/compare/v2.2.0...v2.2.1) (2021-05-27)
### Bug Fixes
* add package json auto updates ([ce56d75](https://github.com/easingthemes/ssh-deploy/commit/ce56d75fc1b62a99d72ffba70dcb24fcc3b6b3df))
# [2.2.0](https://github.com/easingthemes/ssh-deploy/compare/v2.1.7...v2.2.0) (2021-05-27)
### Bug Fixes
* only=prod package json ([95f4dc8](https://github.com/easingthemes/ssh-deploy/commit/95f4dc8069045c1f5f726e00cb519b46e4f14267))
* replace i with ci ([50d1f57](https://github.com/easingthemes/ssh-deploy/commit/50d1f576f95c0d7e8ce99fb1b2ab68b2594973e5))
* update ncc ([20a0cae](https://github.com/easingthemes/ssh-deploy/commit/20a0cae1ae81bcc430507363e800342976307a81))
* update plugins ([b2adc00](https://github.com/easingthemes/ssh-deploy/commit/b2adc00c92f129aef41ae46441411c2bebc0dbe4))
* update plugins ([a50a999](https://github.com/easingthemes/ssh-deploy/commit/a50a999528b503846cc7fdf26210f710bd95565a))
### Features
* add semantic-release-action ([ac3c9b5](https://github.com/easingthemes/ssh-deploy/commit/ac3c9b51d5cb52f4add40e2fc2dcc5e970153afc))

1437
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +1,27 @@
{
"name": "ssh-deploy",
"version": "2.1.5",
"description": "This GitHub Action deploys specific directory from `GITHUB_WORKSPACE` to a folder on a server via rsync over ssh.",
"main": "src/index.js",
"name": "@draganfilipovic/ssh-deploy",
"version": "2.2.11",
"description": "Fast NodeJS action to deploy specific directory from `GITHUB_WORKSPACE` to a server via rsync over ssh.",
"main": "dist/index.js",
"files": [
"/dist",
"./action.yml",
"./README.md",
"LICENSE"
],
"dependencies": {
"command-exists": "1.2.8",
"node-cmd": "3.0.0",
"command-exists": "1.2.9",
"node-cmd": "4.0.0",
"rsyncwrapper": "3.0.1"
},
"devDependencies": {
"@zeit/ncc": "^0.20.5",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.2"
"@vercel/ncc": "^0.28.6",
"eslint": "^7.27.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.23.3"
},
"scripts": {
"build": "npm run lint && ncc build ./src/index.js -o dist",
"build": "npm run lint && ncc build ./src/index.js -o dist -m",
"lint": "eslint ./src/index.js",
"lint:fix": "eslint ./src/index.js --fix"
},
@@ -29,7 +35,7 @@
"rsync"
],
"author": "Dragan Filipovic",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://github.com/easingthemes/ssh-deploy/issues"
},

View File

@@ -7,7 +7,7 @@ const { addSshKey } = require('./sshKey');
const {
REMOTE_HOST, REMOTE_USER,
REMOTE_PORT, SSH_PRIVATE_KEY, DEPLOY_KEY_NAME,
SOURCE, TARGET, ARGS,
SOURCE, TARGET, ARGS, EXCLUDE,
GITHUB_WORKSPACE
} = require('./inputs');
@@ -20,13 +20,14 @@ const defaultOptions = {
console.log('[general] GITHUB_WORKSPACE: ', GITHUB_WORKSPACE);
const sshDeploy = (() => {
const rsync = ({ privateKey, port, src, dest, args }) => {
const rsync = ({ privateKey, port, src, dest, args, exclude }) => {
console.log(`[Rsync] Starting Rsync Action: ${src} to ${dest}`);
if (exclude) console.log(`[Rsync] exluding folders ${exclude}`);
try {
// RSYNC COMMAND
nodeRsync({
src, dest, args, privateKey, port, ...defaultOptions
src, dest, args, privateKey, port, excludeFirst: exclude, ...defaultOptions
}, (error, stdout, stderr, cmd) => {
if (error) {
console.error('⚠️ [Rsync] error: ', error.message);
@@ -44,12 +45,12 @@ const sshDeploy = (() => {
}
};
const init = ({ src, dest, args, host = 'localhost', port, username, privateKeyContent }) => {
const init = ({ src, dest, args, host = 'localhost', port, username, privateKeyContent, exclude = [] }) => {
validateRsync(() => {
const privateKey = addSshKey(privateKeyContent, DEPLOY_KEY_NAME || 'deploy_key');
const remoteDest = `${username}@${host}:${dest}`;
rsync({ privateKey, port, src, dest: remoteDest, args });
rsync({ privateKey, port, src, dest: remoteDest, args, exclude });
});
};
@@ -68,7 +69,8 @@ const run = () => {
host: REMOTE_HOST,
port: REMOTE_PORT || '22',
username: REMOTE_USER,
privateKeyContent: SSH_PRIVATE_KEY
privateKeyContent: SSH_PRIVATE_KEY,
exclude: (EXCLUDE || '').split(',').map((item) => item.trim()) // split by comma and trim whitespace
});
};

View File

@@ -1,4 +1,4 @@
const inputNames = ['REMOTE_HOST', 'REMOTE_USER', 'REMOTE_PORT', 'SSH_PRIVATE_KEY', 'DEPLOY_KEY_NAME', 'SOURCE', 'TARGET', 'ARGS'];
const inputNames = ['REMOTE_HOST', 'REMOTE_USER', 'REMOTE_PORT', 'SSH_PRIVATE_KEY', 'DEPLOY_KEY_NAME', 'SOURCE', 'TARGET', 'ARGS', 'EXCLUDE'];
const inputs = {
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE