Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
namespace Deployer;
$startTime = microtime(true);
require 'recipe/common.php';
// Project name
set('application', 'xxx');
// Project repository
set('repository', 'git@bitbucket.org:xxx/xxx.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
set('shared_files', [
'.env'
]);
set('shared_dirs', []);
// Writable dirs by web server
set('writable_dirs', []);
// Hosts
set('branch', 'production');
host('xxx.xxx.xxx.xxx')
->stage('production')
->user('deployer')
->identityFile('~/.ssh/deployerkey')
->set('deploy_path', '/var/www/{{application}}');
host('xxx.xxx.xxx.xxx')
->stage('production')
->user('deployer')
->identityFile('~/.ssh/deployerkey')
->set('deploy_path', '/var/www/{{application}}');
// Tasks
task('notify:done', function () use ($startTime) {
$seconds = intval(microtime(true) - $startTime);
$minutes = substr('0' . intval($seconds / 60), -2);
$seconds %= 60;
$seconds = substr('0' . $seconds, -2);
shell_exec("osascript -e 'display notification \"It took: $minutes:$seconds\" with title \"Deploy Finished\"'");
});
desc('Deploy your project');
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:symlink',
'deploy:unlock',
'cleanup',
'success',
'notify:done'
]);
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment