Created
January 14, 2018 21:16
-
-
Save marco-souza/98dc35a56f3a54c118b94b75949b4075 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(shipit) { | |
require('shipit-deploy')(shipit) | |
const ENV = process.env.NODE_ENV || 'development' | |
, config = require('./config').deploy | |
, NPM_BIN = config.NPM_BIN | |
, FOREVER_BIN = config.FOREVER_BIN | |
, SHIPIT_DIR = config.SHIPIT_DIR | |
, NODE_BIN = config.NODE_BIN | |
, branch = ENV === 'production' ? 'master' : 'dev' | |
, deployTo = `${SHIPIT_DIR}${ENV === 'production' ? 'metapod' : 'metapod-dev'}` | |
shipit.blTask('yarn-install', () => shipit.remote(`cd ${shipit.releasePath} && yarn`)) | |
shipit.blTask('start-server', () => shipit.remote(`cd ${shipit.releasePath} && NODE_ENV=${ENV} ${FOREVER_BIN} start -a --uid 'metapod_${ENV}' index.js `).catch(console.log)) | |
shipit.blTask('stop-server', () => shipit.remote(`cd ${shipit.releasePath} && NODE_ENV=${ENV} ${FOREVER_BIN} stop metapod_${ENV}`).catch(console.log)) | |
shipit.on('updated', () => { | |
shipit.start('yarn-install') | |
shipit.start('stop-server') | |
}) | |
shipit.on('published', () => shipit.start('start-server')) | |
shipit.initConfig({ | |
default: { | |
workspace: '/tmp/metapod', | |
servers: '[email protected]', | |
repositoryUrl: '[email protected]:inkitt/metapod.git', | |
ignores: ['.git', 'node_modules'], | |
rsync: ['--del'], | |
keepReleases: 3, | |
shallowClone: true, | |
branch, | |
deployTo, | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment