How to deploy the latest release version by deployer

482 Views Asked by At

I using a deployer to deploy my Laravel project. like below

<?php
namespace Deployer;

require 'recipe/laravel.php';

// Project repository
set('repository', '[email protected]');

// Shared files/dirs between deploys 
add('shared_files', []);
add('shared_dirs', []);

// Writable dirs by web server 
add('writable_dirs', []);

// copy relies
add('copy_dirs', ['node_modules', 'vendor']);
before('deploy:vendors', 'deploy:copy_dirs');

// Hosts
host('ip')
    ->user('www-data')
    ->identityFile('~/.ssh/id_rsa')
    ->set('deploy_path', '/var/www/example.com.deploy');

// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

// Migrate database before symlink new release.
before('deploy:symlink', 'artisan:migrate');

But the deployer will deploy the code from main branch, what I want is delpoying the code of latest release branch.

How can I do this? I read the document, but nothing helps. Thanks a lot!

0

There are 0 best solutions below