Skip to content

Commit

Permalink
Fix deploy:env task
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Oct 23, 2024
1 parent 549e865 commit 77c69c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 5 additions & 3 deletions recipe/deploy/env.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
6 changes: 1 addition & 5 deletions recipe/spiral.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion recipe/symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}"');
});
Expand Down

0 comments on commit 77c69c3

Please sign in to comment.