Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rishiqing/rishiqing-deploy
rishiqing front auto deploy
https://github.com/rishiqing/rishiqing-deploy
Last synced: about 2 months ago
JSON representation
rishiqing front auto deploy
- Host: GitHub
- URL: https://github.com/rishiqing/rishiqing-deploy
- Owner: rishiqing
- Created: 2016-12-05T07:10:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-05T10:02:17.000Z (almost 4 years ago)
- Last Synced: 2024-11-11T15:31:51.448Z (2 months ago)
- Language: JavaScript
- Size: 62.5 KB
- Stars: 4
- Watchers: 6
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Deploy your static files with a thousand methods :boom: :boom: :boom:
=====## Intro
+ Integrated ftp, sftp, ssh2, aliyunOss.
+ Uses a configuration file with [yaml](http://yaml.org/) format.
+ Reasonable notification configuration, real-time deployment status.
+ Suitable for automatic build## Install
``` bash
npm i rishiqing-deploy
```## Implementation
In rishiqing-deploy, we provide four kinds of task: build, resource, fileReplace, endBuild. All tasks are executed in the order of : build -> resource -> fileReplace -> endBuild. Once the error, the subsequent tasks will stop.We also intend to provide types notification tools, now only bearychat, but we will add more later.
### build
Execute at the very beginning. all commands inside build will been executed. once the error, the task will stop.### resource
Resource is used to upload files to servers. Use different tools to upload. This will covere the file of the same name.### fileReplace
FileReplace is just like resource, but it is used to replace the entry files, such as `index.html`. Before upload, it will rename the file/directory which the target specified, then upload the local file/directory as the name of target specified.### endBuild
EndBuild is used to do some work after uploads, such as clean directory.## Usage
### Configuration file
Without install rishiqing-deploy globally, you can install it locally, then add a script field to your `package.json`
```json
{
"script": {
"rd": "rishiqing-deploy"
}
}
```
When you execute `npm run rd`, the command will automatic load a file named `.rishiqing-deploy.yml` for configuration. you can also customize by `npm run rd -- --config=YOUR_CONFIG_FILE_NAME`.Configuration file is `NODE_ENV` friendly, you can set the environment variable `NODE_ENV` or `npm run rd -- --env=production` to define the environment. once the environment is defined, the default configure will been covered by it.
```yaml
default: # the default config
notify:
title: 'rishiqing-deploy' # the title of notification, default is rishiqing-deploy
nodes: # define notification node
- 'after-build' # after execute all build commands
- 'one-build' # after one build command
- 'one-upload' # in resource or fileReplace task, after a uploading
- 'one-file-upload' # after one file uploaded
- 'one-resource' # after one resource task
- 'resource' # after all resources tasks
- 'one-file-replace' # after one fileReplace task
- 'file-replace' # after all fileReplace tasks
- 'statistics' # send the statistics information
- 'success' # ending with success
- 'error' # when error throwing out
- 'deploy-log' # generate deploy log after build
list:
- type: bearychat # bearychat notification
param:
hook: '' # bearychat incoming hook
user: 'qinyang' # the user who you want to notify
title: '' # coverd the title as previously defined
channel: 'automaitc-deploy' # the channel which you want to notify. note: channel has priority over user
nodes: # filter the nodes those you need
- 'one-resource'
- 'resource'
- 'one-file-replace'
- 'file-replace'
- 'success'
- type: dingtalk # dingding notification
param:
hook: 'https://oapi.dingtalk.com/robot/send?access_token=xxxxx' # dingtalk notification hook
deployLog: # deploy log
match: '/^log--/' # match commit message begin with log--
beforeSha: 1fcba37592714962 # default is process.env.CI_COMMIT_BEFORE_SHA
tagPrefix: master-deploy- # default is master-deploy-
tagMatch: '/master-deploy-v(0|[1-9]\d*).(0|[1-9]\d*).(0|[1-9]\d*)/'
timeZone: 'Asia/Shanghai' # default is Asia/Shanghai
timeFormat: 'YYYY-MM-DD HH:mm' # default is YYYY-MM-DD HH:mm
branch: master # default is process.env.CI_COMMIT_REF_NAME
projectUrl: https://gitlab.com/xxx/xxx # default is process.env.CI_PROJECT_URL
replaceMatch: true # replace match with empty string
title: 'deploy log' # default is deploy log
goToLink: https://gitlab.com'
version: '0.0.1'convert: # convert file type (now support convert yml to json)
- target: /path/to/the/file/to/be/converted
dest: /path/to/outputbuild: # define the build command list
- 'npm run webpack'
resource:
- dist: 'dist' # local file or directory
ignore: # the ignore list, support regexp
- 'images'
- 'index.html'
- 'manifest.json'
- '/\.map$/'
upload: # specify the upload tool. the tools specified will been executed one by one.
- type: 'aliyunOss'
param:
accessKeyId: ''
# accessKeySecret and secretAccessKey is same
# There are two because the earliest parameter is called secretAccessKey
# but after updating ali-oss, the parameter name was changed to accessKeySecret
# in order to be compatible with the previous configuration, two parameters are supported at the same time.
accessKeySecret: ''
secretAccessKey: ''
bucket: ''
# Set the region or endpoint
region: 'oss-cn-beijing'
# the priority of the endpoint is higher than the region
endpoint: 'http://oss-cn-beijing.aliyuncs.com'
prefix: ''
- type: 'ftp'
param:
host: ''
port: 21
user: ''
password: ''
path: ''
- type: 'sftp'
param:
host: ''
port: 22
username: ''
password: ''
path: ''
- type: 'ssh2' # use ssh2, you must be able to access the server through a certificate
param:
host: ''
port: 22
user: ''
path: ''
fileReplace:
- dist: 'dist/app.js' # local file or directory
ignore:
- ''
target: 'global.js'
upload:
- type: 'aliyunOss'
param:
accessKeyId: ''
# accessKeySecret and secretAccessKey is same
# There are two because the earliest parameter is called secretAccessKey
# but after updating ali-oss, the parameter name was changed to accessKeySecret
# in order to be compatible with the previous configuration, two parameters are supported at the same time.
accessKeySecret: ''
secretAccessKey: ''
bucket: ''
# Set the region or endpoint
region: 'oss-cn-beijing'
# the priority of the endpoint is higher than the region
endpoint: 'http://oss-cn-beijing.aliyuncs.com'
prefix: ''
- type: 'ftp'
param:
host: ''
port: 21
user: ''
password: ''
path: ''
- type: 'sftp'
param:
host: ''
port: 22
username: ''
password: ''
path: ''
- type: 'ssh2'
param:
host: ''
port: 22
user: ''
path: ''
endBuild:
- 'npm run clean'
production: # the production environment. will covere the defualt config
resource:
- dist: 'dist'
ignore:
- 'images'
- 'index.html'
- 'manifest.json'
- '/\\.map$/' # '\' must be '\' escaped
upload:
- type: 'sftp'
param:
host: ''
port: 22
username: ''
password: ''
path: ''
- type: 'ssh2'
param:
host: ''
port: 22
user: ''
path: ''
```## License
[MIT](http://opensource.org/licenses/MIT)
Copyright (c) 2014-2016 [Rishiqing](https://www.rishiqing.com)