Skip to content

Commit 4871059

Browse files
authored
Merge pull request #10 from gaambo/development
v3.1.0
2 parents c4e201f + 7e8ee1e commit 4871059

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v3.1.0
4+
5+
- Added a `deploy:build_assets` step into the default deploy task to build theme assets on local.
6+
This allows for easier overwriting this task (eg to build custom plugin assets) and fixes running duplicates on some configurations.
7+
38
## v3.0.0
49

510
- Did a large refactor of paths (release_path, current_path, document_root)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gaambo/deployer-wordpress",
33
"description": "Deployer tasks for deploying WordPress Sites",
4-
"version": "3.0.0",
4+
"version": "3.1.0",
55
"type": "library",
66
"license": "MIT",
77
"homepage": "https://github.com/gaambo/deployer-wordpress",

recipes/advanced.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
task('deploy', [
1919
'deploy:prepare',
20+
'deploy:build_assets',
2021
'deploy:update_code',
2122
'deploy:symlink', // Add additional symlink task
2223
'deploy:publish'

recipes/common.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@
1010
use Deployer\Deployer;
1111

1212
use function Deployer\after;
13-
use function Deployer\before;
1413
use function Deployer\get;
1514
use function Deployer\has;
1615
use function Deployer\info;
1716
use function Deployer\invoke;
18-
use function Deployer\localhost;
1917
use function Deployer\on;
2018
use function Deployer\run;
2119
use function Deployer\selectedHosts;
2220
use function Deployer\task;
2321
use function Deployer\test;
22+
use function Gaambo\DeployerWordpress\Utils\Localhost\getLocalhost;
2423

2524
$deployerPath = 'vendor/deployer/deployer/';
2625
require_once $deployerPath . 'recipe/common.php';
@@ -51,9 +50,20 @@
5150
'deploy:release'
5251
])->desc('Prepares a new release');
5352

53+
// Build theme assets via npm locally
54+
task('deploy:build_assets', function () {
55+
on(getLocalhost(), function () {
56+
if (has('theme/name')) {
57+
invoke('theme:assets:vendors');
58+
invoke('theme:assets:build');
59+
}
60+
});
61+
})->once();
62+
5463
// Overwrite deployment with rsync (instead of git)
5564
Deployer::get()->tasks->remove('deploy:check_remote');
5665
Deployer::get()->tasks->remove('deploy:update_code');
66+
// Push all files (incl 'wp:push', 'uploads:push', 'plugins:push', 'mu-plugins:push', 'themes:push')
5767
task('deploy:update_code', ['files:push'])
5868
->desc('Pushes local code to the remote hosts');
5969

@@ -70,23 +80,14 @@
7080
// Complete deploy task which includes preparation, pushing code and publishing
7181
task('deploy', [
7282
'deploy:prepare',
83+
'deploy:build_assets',
7384
'deploy:update_code',
7485
'deploy:publish',
7586
])->desc('Deploy WordPress project');
7687

7788
// If deploy fails automatically unlock.
7889
after('deploy:failed', 'deploy:unlock');
7990

80-
// build theme assets via npm locally
81-
before('deploy:update_code', function () {
82-
on(localhost(), function () {
83-
if (!has('theme/name')) {
84-
invoke('theme:assets:vendors');
85-
invoke('theme:assets:build');
86-
}
87-
});
88-
});
89-
9091
/**
9192
* Clears cache via cli
9293
* eg via WP Rocket WP CLI command

recipes/simple.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
task('deploy', [
4040
'deploy:prepare',
41+
'deploy:build_assets',
4142
'deploy:update_code',
4243
'deploy:publish'
4344
])->desc('Deploy WordPress Site');

0 commit comments

Comments
 (0)