diff --git a/recipe/deploy/env.php b/recipe/deploy/env.php index 158054615..38b1d8448 100644 --- a/recipe/deploy/env.php +++ b/recipe/deploy/env.php @@ -2,11 +2,13 @@ namespace Deployer; +set('dotenv_example', '.env.example'); + desc('Configure .env file'); task('deploy:env', function () { - cd('{{release_path}}'); - if (test('[ -f .env.example ]')) { - run('cp .env.example .env'); + cd('{{release_or_current_path}}'); + if (test('[ ! -f .env ] && [ -f {{dotenv_example}} ]')) { + run('cp {{dotenv_example}} .env'); set('new_deployment', true); } }); diff --git a/recipe/spiral.php b/recipe/spiral.php index 6b2afac9b..41b7beb75 100644 --- a/recipe/spiral.php +++ b/recipe/spiral.php @@ -15,10 +15,7 @@ // Path to the RoadRunner server set('roadrunner_path', '{{release_or_current_path}}'); -desc('Create .env file if it doesn\'t exist'); -task('deploy:environment', function (): void { - run('cd {{release_or_current_path}} && [ ! -f .env ] && cp .env.sample .env'); -}); +set('dotenv_example', '.env.sample'); /** * Run a console command. @@ -148,7 +145,6 @@ function rr(string $command, array $options = []): \Closure desc('Deploys your project'); task('deploy', [ 'deploy:prepare', - 'deploy:environment', 'deploy:vendors', 'spiral:encrypt-key', 'spiral:configure', diff --git a/recipe/symfony.php b/recipe/symfony.php index 1c1e9af9a..f5d9d312d 100644 --- a/recipe/symfony.php +++ b/recipe/symfony.php @@ -64,7 +64,7 @@ }); desc('Optimize environment variables'); -task('deploy:env', function () { +task('deploy:dump-env', function () { within('{{release_or_current_path}}', function () { run('{{bin/composer}} dump-env "${APP_ENV:-prod}"'); });