Skip to content

Commit

Permalink
Merge pull request #10 from gaambo/development
Browse files Browse the repository at this point in the history
v3.1.0
  • Loading branch information
gaambo authored Jun 21, 2023
2 parents c4e201f + 7e8ee1e commit 4871059
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v3.1.0

- Added a `deploy:build_assets` step into the default deploy task to build theme assets on local.
This allows for easier overwriting this task (eg to build custom plugin assets) and fixes running duplicates on some configurations.

## v3.0.0

- Did a large refactor of paths (release_path, current_path, document_root)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gaambo/deployer-wordpress",
"description": "Deployer tasks for deploying WordPress Sites",
"version": "3.0.0",
"version": "3.1.0",
"type": "library",
"license": "MIT",
"homepage": "https://github.com/gaambo/deployer-wordpress",
Expand Down
1 change: 1 addition & 0 deletions recipes/advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

task('deploy', [
'deploy:prepare',
'deploy:build_assets',
'deploy:update_code',
'deploy:symlink', // Add additional symlink task
'deploy:publish'
Expand Down
25 changes: 13 additions & 12 deletions recipes/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@
use Deployer\Deployer;

use function Deployer\after;
use function Deployer\before;
use function Deployer\get;
use function Deployer\has;
use function Deployer\info;
use function Deployer\invoke;
use function Deployer\localhost;
use function Deployer\on;
use function Deployer\run;
use function Deployer\selectedHosts;
use function Deployer\task;
use function Deployer\test;
use function Gaambo\DeployerWordpress\Utils\Localhost\getLocalhost;

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

// Build theme assets via npm locally
task('deploy:build_assets', function () {
on(getLocalhost(), function () {
if (has('theme/name')) {
invoke('theme:assets:vendors');
invoke('theme:assets:build');
}
});
})->once();

// Overwrite deployment with rsync (instead of git)
Deployer::get()->tasks->remove('deploy:check_remote');
Deployer::get()->tasks->remove('deploy:update_code');
// Push all files (incl 'wp:push', 'uploads:push', 'plugins:push', 'mu-plugins:push', 'themes:push')
task('deploy:update_code', ['files:push'])
->desc('Pushes local code to the remote hosts');

Expand All @@ -70,23 +80,14 @@
// Complete deploy task which includes preparation, pushing code and publishing
task('deploy', [
'deploy:prepare',
'deploy:build_assets',
'deploy:update_code',
'deploy:publish',
])->desc('Deploy WordPress project');

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

// build theme assets via npm locally
before('deploy:update_code', function () {
on(localhost(), function () {
if (!has('theme/name')) {
invoke('theme:assets:vendors');
invoke('theme:assets:build');
}
});
});

/**
* Clears cache via cli
* eg via WP Rocket WP CLI command
Expand Down
1 change: 1 addition & 0 deletions recipes/simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

task('deploy', [
'deploy:prepare',
'deploy:build_assets',
'deploy:update_code',
'deploy:publish'
])->desc('Deploy WordPress Site');

0 comments on commit 4871059

Please sign in to comment.