Skip to content

Commit 922317a

Browse files
committed
chore: use upload function
1 parent ed77fde commit 922317a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

recipe/deploy/update_code.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,22 @@
7373
task('deploy:update_code', function () {
7474
$strategy = get('update_code_strategy');
7575
$target = get('target');
76+
$git = get('bin/git');
7677

7778
$targetWithDir = $target;
7879
if (!empty(get('sub_directory'))) {
7980
$targetWithDir .= ':{{sub_directory}}';
8081
}
8182

8283
if ($strategy === 'local_archive') {
83-
$host = currentHost()->connectionString();
84-
85-
// Copy to release_path.
86-
runLocally(<<<BASH
87-
git archive {$targetWithDir} | ssh {$host} "tar -x -f - -C {{release_path}} 2>&1"
88-
BASH);
84+
runLocally("$git archive $targetWithDir -o archive.tar");
85+
upload('archive.tar', '{{release_path}}/archive.tar');
86+
run("tar -xf {{release_path}}/archive.tar -C {{release_path}}");
87+
run("rm {{release_path}}/archive.tar");
88+
unlink('archive.tar');
8989

9090
$rev = escapeshellarg(runLocally("git rev-list $target -1"));
9191
} else {
92-
$git = get('bin/git');
9392
$repository = get('repository');
9493

9594
if (empty($repository)) {

0 commit comments

Comments
 (0)