mirror of
https://github.com/easingthemes/ssh-deploy.git
synced 2024-11-19 08:08:05 +08:00
Compare commits
59 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
649339f4bb | ||
|
66e6843055 | ||
|
0867b12954 | ||
|
d71ce0f0b2 | ||
|
382db98e53 | ||
|
191c82d9b4 | ||
|
5109c975e9 | ||
|
76882263e5 | ||
|
9c4e4119ad | ||
|
fbeaefca08 | ||
|
f04642c1f5 | ||
|
fdf6057d5e | ||
|
87551c3893 | ||
|
83d848a9e4 | ||
|
9c02ed6208 | ||
|
2197bc60ef | ||
|
eb4a19604b | ||
|
09342ca039 | ||
|
40096bf224 | ||
|
4383250122 | ||
|
142b71c9e1 | ||
|
8218c8ed95 | ||
|
b75a6aac49 | ||
|
a0be71d296 | ||
|
87ad6713b5 | ||
|
b12dcbe93c | ||
|
c984a47bf5 | ||
|
5e456a475a | ||
|
a9eda89ad7 | ||
|
3cfa1cdc25 | ||
|
ce56d75fc1 | ||
|
74b3a2aba4 | ||
|
77bfc8c169 | ||
|
ac3c9b51d5 | ||
|
a0be893c82 | ||
|
50d1f576f9 | ||
|
20a0cae1ae | ||
|
95f4dc8069 | ||
|
b2adc00c92 | ||
|
a50a999528 | ||
|
1242867d7a | ||
|
33648ba2ca | ||
|
40a3789c05 | ||
|
7e2c0f29d6 | ||
|
e9c43c6900 | ||
|
9ae3c340cb | ||
|
386c8766a0 | ||
|
130901534a | ||
|
8b977327bb | ||
|
880f3b6b88 | ||
|
ec4a00fe02 | ||
|
a04c641775 | ||
|
9483c83d88 | ||
|
e41d593e15 | ||
|
9ab3993555 | ||
|
07265c8c95 | ||
|
a27b8667de | ||
|
2b38f7bf7a | ||
|
cd3b869a28 |
31
.github/workflows/build.yml
vendored
Normal file
31
.github/workflows/build.yml
vendored
Normal 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
47
.github/workflows/codeql-analysis.yml
vendored
Normal 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
44
.github/workflows/manual-release.yml
vendored
Normal 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
44
.github/workflows/release.yml
vendored
Normal 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
22
.releaserc
Normal 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"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
13
README.md
13
README.md
@@ -49,13 +49,18 @@ The source directory, path relative to `$GITHUB_WORKSPACE` root, eg: `dist/`
|
|||||||
|
|
||||||
The target directory
|
The target directory
|
||||||
|
|
||||||
|
##### 8. `EXCLUDE` (optional, default '')
|
||||||
|
|
||||||
|
path to exclude separated by `,`, ie: `/dist/, /node_modules/`
|
||||||
|
|
||||||
# Usage
|
# 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
|
- name: Deploy to Staging server
|
||||||
uses: easingthemes/ssh-deploy@v2.1.5
|
uses: easingthemes/ssh-deploy@main
|
||||||
env:
|
env:
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
|
||||||
ARGS: "-rltgoDzvO"
|
ARGS: "-rltgoDzvO"
|
||||||
@@ -63,6 +68,7 @@ The target directory
|
|||||||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||||
TARGET: ${{ secrets.REMOTE_TARGET }}
|
TARGET: ${{ secrets.REMOTE_TARGET }}
|
||||||
|
EXCLUDE: "/dist/, /node_modules/"
|
||||||
```
|
```
|
||||||
|
|
||||||
# Example usage in workflow
|
# Example usage in workflow
|
||||||
@@ -88,7 +94,7 @@ jobs:
|
|||||||
- name: Run build task
|
- name: Run build task
|
||||||
run: npm run build --if-present
|
run: npm run build --if-present
|
||||||
- name: Deploy to Server
|
- name: Deploy to Server
|
||||||
uses: easingthemes/ssh-deploy@v2.1.5
|
uses: easingthemes/ssh-deploy@main
|
||||||
env:
|
env:
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
|
||||||
ARGS: "-rltgoDzvO --delete"
|
ARGS: "-rltgoDzvO --delete"
|
||||||
@@ -96,6 +102,7 @@ jobs:
|
|||||||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||||
TARGET: ${{ secrets.REMOTE_TARGET }}
|
TARGET: ${{ secrets.REMOTE_TARGET }}
|
||||||
|
EXCLUDE: "/dist/, /node_modules/"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
@@ -27,6 +27,10 @@ inputs:
|
|||||||
description: "Arguments to pass to rsync"
|
description: "Arguments to pass to rsync"
|
||||||
required: false
|
required: false
|
||||||
default: "-rltgoDzvO"
|
default: "-rltgoDzvO"
|
||||||
|
EXCLUDE:
|
||||||
|
description: "An array of folder to exclude"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
outputs:
|
outputs:
|
||||||
status:
|
status:
|
||||||
description: "Status"
|
description: "Status"
|
||||||
|
730
dist/index.js
vendored
730
dist/index.js
vendored
File diff suppressed because one or more lines are too long
85
docs/CHANGELOG.md
Normal file
85
docs/CHANGELOG.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
## [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
1437
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
@@ -1,21 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "ssh-deploy",
|
"name": "@draganfilipovic/ssh-deploy",
|
||||||
"version": "2.1.5",
|
"version": "2.2.10",
|
||||||
"description": "This GitHub Action deploys specific directory from `GITHUB_WORKSPACE` to a folder on 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": "src/index.js",
|
"main": "dist/index.js",
|
||||||
|
"files": [
|
||||||
|
"/dist",
|
||||||
|
"./action.yml",
|
||||||
|
"./README.md",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"private": false,
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"command-exists": "1.2.8",
|
"command-exists": "1.2.9",
|
||||||
"node-cmd": "3.0.0",
|
"node-cmd": "4.0.0",
|
||||||
"rsyncwrapper": "3.0.1"
|
"rsyncwrapper": "3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@zeit/ncc": "^0.20.5",
|
"@vercel/ncc": "^0.28.6",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^7.27.0",
|
||||||
"eslint-config-airbnb-base": "^14.1.0",
|
"eslint-config-airbnb-base": "^14.2.1",
|
||||||
"eslint-plugin-import": "^2.20.2"
|
"eslint-plugin-import": "^2.23.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"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": "eslint ./src/index.js",
|
||||||
"lint:fix": "eslint ./src/index.js --fix"
|
"lint:fix": "eslint ./src/index.js --fix"
|
||||||
},
|
},
|
||||||
@@ -29,7 +39,7 @@
|
|||||||
"rsync"
|
"rsync"
|
||||||
],
|
],
|
||||||
"author": "Dragan Filipovic",
|
"author": "Dragan Filipovic",
|
||||||
"license": "ISC",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/easingthemes/ssh-deploy/issues"
|
"url": "https://github.com/easingthemes/ssh-deploy/issues"
|
||||||
},
|
},
|
||||||
|
14
src/index.js
14
src/index.js
@@ -7,7 +7,7 @@ const { addSshKey } = require('./sshKey');
|
|||||||
const {
|
const {
|
||||||
REMOTE_HOST, REMOTE_USER,
|
REMOTE_HOST, REMOTE_USER,
|
||||||
REMOTE_PORT, SSH_PRIVATE_KEY, DEPLOY_KEY_NAME,
|
REMOTE_PORT, SSH_PRIVATE_KEY, DEPLOY_KEY_NAME,
|
||||||
SOURCE, TARGET, ARGS,
|
SOURCE, TARGET, ARGS, EXCLUDE,
|
||||||
GITHUB_WORKSPACE
|
GITHUB_WORKSPACE
|
||||||
} = require('./inputs');
|
} = require('./inputs');
|
||||||
|
|
||||||
@@ -20,13 +20,14 @@ const defaultOptions = {
|
|||||||
console.log('[general] GITHUB_WORKSPACE: ', GITHUB_WORKSPACE);
|
console.log('[general] GITHUB_WORKSPACE: ', GITHUB_WORKSPACE);
|
||||||
|
|
||||||
const sshDeploy = (() => {
|
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}`);
|
console.log(`[Rsync] Starting Rsync Action: ${src} to ${dest}`);
|
||||||
|
if (exclude) console.log(`[Rsync] exluding folders ${exclude}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// RSYNC COMMAND
|
// RSYNC COMMAND
|
||||||
nodeRsync({
|
nodeRsync({
|
||||||
src, dest, args, privateKey, port, ...defaultOptions
|
src, dest, args, privateKey, port, excludeFirst: exclude, ...defaultOptions
|
||||||
}, (error, stdout, stderr, cmd) => {
|
}, (error, stdout, stderr, cmd) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('⚠️ [Rsync] error: ', error.message);
|
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(() => {
|
validateRsync(() => {
|
||||||
const privateKey = addSshKey(privateKeyContent, DEPLOY_KEY_NAME || 'deploy_key');
|
const privateKey = addSshKey(privateKeyContent, DEPLOY_KEY_NAME || 'deploy_key');
|
||||||
const remoteDest = `${username}@${host}:${dest}`;
|
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,
|
host: REMOTE_HOST,
|
||||||
port: REMOTE_PORT || '22',
|
port: REMOTE_PORT || '22',
|
||||||
username: REMOTE_USER,
|
username: REMOTE_USER,
|
||||||
privateKeyContent: SSH_PRIVATE_KEY
|
privateKeyContent: SSH_PRIVATE_KEY,
|
||||||
|
exclude: (EXCLUDE || '').split(',').map((item) => item.trim()) // split by comma and trim whitespace
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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 = {
|
const inputs = {
|
||||||
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE
|
GITHUB_WORKSPACE: process.env.GITHUB_WORKSPACE
|
||||||
|
Reference in New Issue
Block a user