Skip to content
Permalink
Browse files

feat(events): update names and add README entry

  • Loading branch information
Marten Klitzke
Marten Klitzke committed Jun 29, 2018
1 parent 329f03d commit 80e8b445e3e478f6119ea5b53875524990df2109
Showing with 49 additions and 9 deletions.
  1. +30 −0 README.md
  2. +18 −8 index.js
  3. +1 −1 package.json
@@ -69,6 +69,36 @@ To finish your Deployment it will remove the oldest Release to be in lign with t
Run: ```shipit *your-server-env* rollback``` to rollback the latest Release.
This will also delete the Release Folder you are rolling back from.
### Events
You can run Tasks on specific steps of the deployment process.
- installed -> when dependencies are installed.
- built -> when buildCommand has been executed.
- uploaded -> when dirToCopy has been uploaded.
- symlinked -> after the current symlink has been updated.
- finished -> after the deploy is finished.
#### Example
```javascript
module.exports = (shipit) => {
require('shipit-release')(shipit)
shipit.initConfig({
...
})
shipit.on('installed', async () => {
return shipit.start('doStuff')
})
shipit.blTask('doStuff', async () => {
// ... do stuff :)
})
}
```
## Installation
Install the Package with your favorite Packagemanager:
@@ -54,27 +54,29 @@ module.exports = function(shipit) {

utils.registerTask(shipit, 'deploy', [
'deploy:install',
'deploy:build',
'deploy:upload',
'deploy:symlink',
'deploy:cleanup',
'deploy:finish',
])

shipit.task('deploy:finish', () => {
shipit.blTask('deploy:install', async () => {
extendShipit(shipit)

shipit.logInfo(`Done. Deployed version ${shipit.deployTime}`)
shipit.emit('finished')
shipit.logInfo('Installing deps')
await shipit.local(shipit.config.installCommand)

shipit.emit('installed')
})

shipit.blTask('deploy:install', async () => {
shipit.blTask('deploy:build', async () => {
extendShipit(shipit)

shipit.logInfo('Installing deps & Building')
await shipit.local(shipit.config.installCommand)
shipit.logInfo('Build App')
await shipit.local(shipit.config.buildCommand)

shipit.emit('build')
shipit.emit('built')
})

shipit.blTask('deploy:upload', async () => {
@@ -99,7 +101,7 @@ module.exports = function(shipit) {
shipit.logInfo('Updating current Symlink')
await shipit.remote(`ln -nfs ${deployPath} ${shipit.currentPath}`)

shipit.emit('symlink')
shipit.emit('symlinked')
})

shipit.blTask('deploy:cleanup', async () => {
@@ -111,6 +113,14 @@ module.exports = function(shipit) {
await shipit.remote(command)
})

shipit.task('deploy:finish', () => {
extendShipit(shipit)

shipit.emit('finished')

shipit.logInfo(`Done. Deployed version ${shipit.deployTime}`)
})

shipit.task('rollback', async () => {
extendShipit(shipit)

@@ -1,6 +1,6 @@
{
"name": "shipit-release",
"version": "1.1.3",
"version": "1.2.0",
"description": "Shipit Release Plugin",
"main": "index.js",
"scripts": {

0 comments on commit 80e8b44

Please sign in to comment.
You can’t perform that action at this time.