首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Deployer部署不同的分支

使用Deployer部署不同的分支
EN

Stack Overflow用户
提问于 2022-02-25 04:56:08
回答 1查看 682关注 0票数 3

我正在学习如何使用Deployer将Laravel应用程序部署到暂存/生产环境中。

下面的配置可以工作,但它总是部署相同的代码。是否可以将暂存设置为只部署develop分支,并将生产设置为部署master分支?

代码语言:javascript
复制
namespace Deployer;

require 'recipe/laravel.php';

set('application', 'my_app');
set('repository', 'git@github.com:account/repo-name.git');
set('php_fpm_version', '8.0');
set('git_tty', false);

add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);

host('staging')
    ->hostname('hostname-here')
    ->user('username')
    ->identityFile('~/.ssh/id_rsa')
    ->multiplexing(false)
    ->set('deploy_path', '~/staging');

host('production')
    ->hostname('hostname-here')
    ->user('username')
    ->identityFile('~/.ssh/id_rsa')
    ->multiplexing(false)
    ->set('deploy_path', '~/production');

task('build', function () {
    run('cd {{release_path}} && build');
});

after('deploy:failed', 'deploy:unlock');
before('deploy:symlink', 'artisan:migrate');
EN

回答 1

Stack Overflow用户

发布于 2022-07-14 06:06:19

您可以在主机配置中使用->set('branch', 'master')设置分支。

代码语言:javascript
复制
host('staging')
  ->set('branch', 'develop')

host('production')
  ->set('branch', 'master')
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71261232

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档