Last active
September 13, 2017 07:40
-
-
Save urre/1b14a118edd762a0b1127d28d2053725 to your computer and use it in GitHub Desktop.
Deploy a Bedrock based WordPress site using Shipit.js via Codeship CI/CD to a Cloudways server
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
const path = require('path'); | |
require('dotenv').config(); | |
const deployPath = '/home/master/applications/xxxxxxxxx/public_html'; | |
module.exports = function (shipit) { | |
require('shipit-deploy')(shipit); | |
shipit.initConfig({ | |
default: { | |
workspace: '/tmp/reponame', | |
repositoryUrl: '[email protected]:githubuser/reponame.git', | |
branch: 'dev', | |
ignores: ['.git', 'node_modules', '.env', '.htaccess', 'uploads'], | |
keepReleases: 2, | |
rsync: ['--del'], | |
deleteOnRollback: false, | |
key: process.env.WP_ENV === 'development' ? '~/.ssh/id_rsa' : '', | |
shallowClone: true | |
}, | |
staging: { | |
servers: 'user@IP', | |
deployTo: deployPath | |
} | |
}); | |
shipit.blTask('composer', function () { | |
return shipit.remote(`cd ${deployPath}/current && composer install`); | |
}); | |
shipit.blTask('npm', function () { | |
return shipit.remote(`cd ${deployPath}/current/web/app/themes/themename && npm install`); | |
}); | |
shipit.blTask('assets', function () { | |
return shipit.remote(`cd ${deployPath}/current/web/app/themes/themename && npm run build`); | |
}); | |
shipit.on('published', function () { | |
shipit.start(['composer', 'npm','assets']); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Protip
Purge Varnish and restart Memcached on your Cloudways server. You can use this as another custom script in the deployment chain on Codeship.
Get your Cloudways API key here