Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/recipe/deploy/shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,20 @@ set('shared_dirs', ['storage']);



### shared_dirs_populate
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/shared.php#L18)

When true, populate existing shared dirs with any new files/dirs present in the release.
Useful when new subdirectories are added to the repo over time and should be propagated to shared.
Existing files in shared are never overwritten.

```php title="Default value"
false
```


### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/shared.php#L20)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/shared.php#L25)

List of files what will be shared between releases.
Each release will have symlink to those files stored in [deploy_path](/docs/recipe/common.md#deploy_path)/shared dir.
Expand All @@ -38,7 +50,7 @@ set('shared_files', ['.env']);
## Tasks

### deploy\:shared {#deploy-shared}
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/shared.php#L23)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/deploy/shared.php#L28)

Creates symlinks for shared files and dirs.

Expand Down
8 changes: 8 additions & 0 deletions recipe/deploy/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// ```
set('shared_dirs', []);

// When true, populate existing shared dirs with any new files/dirs present in the release.
// Useful when new subdirectories are added to the repo over time and should be propagated to shared.
// Existing files in shared are never overwritten.
set('shared_dirs_populate', false);

// List of files what will be shared between releases.
// Each release will have symlink to those files stored in {{deploy_path}}/shared dir.
// ```php
Expand Down Expand Up @@ -46,6 +51,9 @@
if (test("[ -d $(echo {{release_path}}/$dir) ]")) {
run("cp -r$copyVerbosity {{release_path}}/$dir $sharedPath/" . dirname($dir));
}
} elseif (get('shared_dirs_populate') && test("[ -d $(echo {{release_path}}/$dir) ]")) {
// Populate shared dir with new files/dirs from release without overwriting existing content.
run("cp -r$copyVerbosity --no-dereference --no-clobber {{release_path}}/$dir/. $sharedPath/$dir/");
}

// Remove from source.
Expand Down
Loading