Skip to content

Commit

Permalink
fix for new rc of deployer v7
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Apr 6, 2022
1 parent af38e0c commit 34b6890
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
7 changes: 7 additions & 0 deletions bin/dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

/** @noinspection PhpUndefinedVariableInspection */
require $_composer_bin_dir.'/deployer.phar';
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

"require": {
"php": "^7.4 || ^8.0",
"deployer/deployer": "^7.0@rc"
"deployer/deployer": "^7.0-rc.8@rc"
},

"bin": "bin/dep",

"config": {
"preferred-install": {
"*": "dist"
Expand Down
16 changes: 9 additions & 7 deletions recipe/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

use Deployer\Task\Context;

$baseDir = dirname(DEPLOYER_DEPLOY_FILE);

localhost('local')
->set('deploy_path', DEPLOYER_ROOT.'/.build')
->set('release_path', DEPLOYER_ROOT.'/.build/release')
->set('deploy_path', $baseDir.'/.build')
->set('release_path', $baseDir.'/.build/release')
->set('current_path', '{{release_path}}')
;

Expand Down Expand Up @@ -65,14 +67,14 @@
'deploy:publish',
]);

task('build:setup', function () {
task('build:setup', function () use ($baseDir) {
if ('local' !== Context::get()->getHost()->getAlias()) {
throw new \RuntimeException('Task "build" can only be called on host "local"');
}

if (getenv('CI')) {
set('deploy_path', DEPLOYER_ROOT);
set('release_path', DEPLOYER_ROOT);
set('deploy_path', $baseDir);
set('release_path', $baseDir);

return;
}
Expand Down Expand Up @@ -111,8 +113,8 @@
}
});

task('upload', function () {
$source = getenv('CI') ? DEPLOYER_ROOT : host('local')->get('release_path');
task('upload', function () use ($baseDir) {
$source = getenv('CI') ? $baseDir : host('local')->get('release_path');

upload($source.'/', '{{release_path}}', [
'flags' => '-az',
Expand Down
2 changes: 1 addition & 1 deletion recipe/symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Deployer;

require dirname(DEPLOYER_BIN, 2).'/recipe/symfony.php';
require 'phar://'.DEPLOYER_BIN.'/recipe/symfony.php';
require __DIR__.'/base.php';

set('copy_dirs', [
Expand Down

0 comments on commit 34b6890

Please sign in to comment.