Skip to content

Instantly share code, notes, and snippets.



Created Dec 20, 2018
What would you like to do?
namespace Deployer;
use Exception;
require 'recipe/common.php';
// Project name
set('application', '<application>');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
add('shared_files', ['.htaccess', 'wp-config.php']);
add('shared_dirs', ['wp-content/uploads']);
// Writable dirs by web server
add('writable_dirs', []);
set('allow_anonymous_stats', false);
// Hosts
->set('deploy_path', '<deploy_path>');
task('deploy:update_code', function () {
$tmpfile_resource = tmpfile();
$tmpfile = stream_get_meta_data($tmpfile_resource)['uri'];
runLocally("git archive --format=zip -o $tmpfile HEAD");
run('mkdir -p {{deploy_path}}/tmp');
upload($tmpfile, '{{deploy_path}}/tmp/');
run('unzip -d {{release_path}} {{deploy_path}}/tmp/');
run('rm {{deploy_path}}/tmp/');
task('deploy', [
])->desc('Deploy your project');
after('deploy', 'success');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment