Skip to content

Commit 52e37ed

Browse files
authored
v4.0.0: Merge pull request #14 from gaambo/v4
Version 4
2 parents 92ec3e4 + cad0c30 commit 52e37ed

94 files changed

Lines changed: 9326 additions & 1575 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{json,yml,yaml,md}]
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.php]
18+
max_line_length = 120

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.editorconfig export-ignore
2+
/.gitattributes export-ignore
3+
/.github/ export-ignore
4+
/.gitignore export-ignore
5+
/docs/ export-ignore
6+
/phpcs.xml export-ignore
7+
/phpstan.neon export-ignore
8+
/phpunit.xml export-ignore
9+
/tests/ export-ignore

.github/workflows/code-quality.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
pull_request:
6+
# Allow manually triggering the workflow.
7+
workflow_dispatch:
8+
9+
jobs:
10+
code-quality:
11+
name: Run Code Quality Checks
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
strategy:
15+
matrix:
16+
php: ['8.1', '8.2', '8.3', '8.4']
17+
fail-fast: false
18+
19+
steps:
20+
# Checkout the repository
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
# Setup PHP with Composer and cs2pr
25+
- name: Setup PHP and tools
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
tools: composer:v2, cs2pr
30+
31+
# Validate composer.json
32+
- name: Validate composer.json
33+
run: composer validate --strict
34+
35+
# Install dependencies with caching
36+
- name: Install Composer dependencies
37+
uses: ramsey/composer-install@v3
38+
with:
39+
composer-options: '--prefer-dist --no-progress'
40+
41+
# Run PHP syntax linting
42+
- name: Run PHP syntax linting
43+
run: composer run-script lint
44+
45+
# Run PHP CodeSniffer with GitHub annotations
46+
- name: Run PHP CodeSniffer
47+
run: |
48+
composer run-script phpcs -- --standard=phpcs.xml --report-checkstyle=./phpcs-report.xml
49+
cs2pr ./phpcs-report.xml
50+
51+
# Run PHPStan with GitHub annotations
52+
- name: Run PHPStan
53+
run: |
54+
composer run-script phpstan -- --error-format=checkstyle > phpstan-report.xml
55+
cs2pr ./phpstan-report.xml
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Composer Lock Diff
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'composer.json'
7+
- 'composer.lock'
8+
9+
jobs:
10+
composer-diff:
11+
name: Composer Lock Diff
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
steps:
15+
# Checkout the repository
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
# Generate composer.lock diff
22+
- name: Generate composer.lock diff
23+
id: composer-diff
24+
uses: IonBazan/composer-diff-action@v1
25+
26+
# Post diff as sticky comment
27+
- name: Post diff as sticky comment
28+
uses: marocchino/sticky-pull-request-comment@v2
29+
with:
30+
message: |
31+
## Composer Package Changes
32+
${{ steps.composer-diff.outputs.diff }}

.github/workflows/tests.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pull Request Tests
1+
name: Tests
22

33
on:
44
pull_request:
@@ -7,19 +7,43 @@ on:
77

88
jobs:
99
tests:
10-
name: Run PHPUnit Tests
1110
runs-on: ubuntu-latest
1211
timeout-minutes: 10
1312
strategy:
1413
matrix:
15-
php: ['8.1', '8.2', '8.3', '8.4']
14+
php: [ '8.1', '8.2', '8.3', '8.4' ]
1615
# TODO: Add 8.0 when released.
17-
deployer: ['^7.3', '^7.4', '^7.5']
18-
include:
19-
- name: Deployer ${{ matrix.deployer }} on PHP ${{ matrix.php }}
16+
deployer: [ '7.3', '7.4', '7.5' ]
2017
fail-fast: false
18+
name: Tests for Deployer ${{ matrix.deployer }} on PHP ${{ matrix.php }}
2119

2220
steps:
2321
# Checkout the repository
2422
- name: Checkout repository
2523
uses: actions/checkout@v4
24+
25+
# Setup PHP with Composer
26+
- name: Setup PHP and tools
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
tools: composer:v2
31+
32+
# Install dependencies with caching
33+
- name: Install Composer dependencies
34+
uses: ramsey/composer-install@v3
35+
with:
36+
composer-options: '--prefer-dist --no-progress'
37+
38+
# Install specific Deployer version
39+
- name: Install Deployer version
40+
# Install latest patch of the specified version.
41+
run: composer require --no-update deployer/deployer:"${{ matrix.deployer }}.*"
42+
43+
# Run PHPStan so we check compatibility with the specified Deployer version.
44+
- name: Run PHPStan
45+
run: composer run-script phpstan
46+
47+
# Run PHPUnit tests
48+
- name: Run PHPUnit tests
49+
run: composer run-script tests

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
/vendor/
2-
/test
1+
/vendor
2+
/.cursor
3+
/.junie
4+
/.idea
5+
.DS_STORE
6+
.phpunit.cache
7+
.phpunit.result.cache
8+
tests/coverage

CHANGELOG.md

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,56 @@
11
# Changelog
22

3+
## v4.0.0 - 2025-03-20
4+
5+
v4 is a major refactor focusing on simpler, rsync-based deployments with better developer experience.
6+
7+
_Info:_ This release does not yet officially support Deployer v8, since it's not released yet.
8+
9+
### Breaking Changes
10+
11+
- **Architecture**: Now uses `current_path` as primary deployment target instead of symlinked `release_path`. Atomic
12+
releases via symlinks are still possible but no longer the default.
13+
- **PSR-4 structure**: Internal code reorganized with PSR-4 autoloading. Task files moved from `src/tasks/` to `tasks/`.
14+
- **Removed `advanced` recipe**: Use `simple` or `bedrock` recipes instead.
15+
- **Removed `:sync` tasks**: Use explicit `:push` and `:pull` tasks instead.
16+
17+
### Added
18+
19+
- **Packages system**: Unified way to manage custom themes, plugins, and mu-plugins with individual build scripts and
20+
vendor configs.
21+
- Older `themes`/`plugins`/`mu-plugins` are still available for backwards compatibility, but will be removed in a future
22+
release.
23+
- **Multisite support**: Set `wp/multisite` flag for proper URL replacements during database sync.
24+
- **Language tasks**: New tasks for syncing language files (`languages:push`, `languages:pull`, `languages:backup:*`).
25+
- **Localhost context**: Proper context handling for local operations with consistent path resolution.
26+
- **New recipes**: `recipes/simple.php` for rsync deployments, `recipes/bedrock.php` for Bedrock projects.
27+
- **Comprehensive tests**: Full integration and functional test suite.
28+
29+
### Changed
30+
31+
- Improved bin detection and auto-installation for `composer` and `wp-cli`.
32+
- Enhanced database task logic for URL/path replacements.
33+
- Better sudo prefix handling in binary execution.
34+
35+
### Fixed
36+
37+
- Database pulling and local importing.
38+
- Recipe include paths when installed via composer.
39+
- Path resolution in localhost operations.
40+
41+
### Upgrading from v3.x
42+
43+
1. **Set `current_path`**: Define where your WordPress root lives on each host (including localhost).
44+
2. **Migrate to packages**: Move theme/plugin build config to the new `packages` configuration.
45+
3. **Update recipe**: Switch from old recipes to `recipes/simple.php` or `recipes/bedrock.php`.
46+
4. **Check examples**: Review `examples/simple/` or `examples/bedrock/` for updated patterns.
47+
5. **Replace `:sync` tasks**: Update custom tasks using `:sync` to use `:push` or `:pull`.
48+
349
## v3.1.0
450

551
- 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.
52+
This allows for easier overwriting this task (eg to build custom plugin assets) and fixes running duplicates on some
53+
configurations.
754

855
## v3.0.0
956

@@ -17,25 +64,33 @@ This allows for easier overwriting this task (eg to build custom plugin assets)
1764
- Removed `document_root` - use `release_or_current_path` instead
1865
- New/changed task names:
1966
- `push_code` now is called `update_code` again for parity with PHPDeployer.
20-
67+
2168
**Upgrading:**
22-
- If you haven't upgraded to v2.0.0 yet, it's best to upgrade to 3.0.0 directly
23-
- Have a look at the example files. Your deploy.php will get much smaller and require less configuration.
24-
- Also the new version is more smiliar to PHPDeployers default common recipe.
69+
70+
- If you haven't upgraded to v2.0.0 yet, it's best to upgrade to 3.0.0 directly
71+
- Have a look at the example files. Your deploy.php will get much smaller and require less configuration.
72+
- Also the new version is more smiliar to PHPDeployers default common recipe.
2573

2674
## v2.0.0
2775

2876
- Updated from Deployer 6.x to 7.x
2977
See [docs](https://deployer.org/docs/7.x/UPGRADE#upgrade-from-6x-to-7x) for more information.
3078
Most notable changes:
31-
- New format for yml-files which can now also include configuration.
32-
- The `local` is not available any more. Instead `once` and `runLocally` should be used. For theme assets the example uses a function callback and the `on` helper to optionally run those build tasks on the local host.
33-
- When deploying you can't select a host by name or stage anymore. Instead you have to use labels (eg a `stage` label). If you've used `dep deploy production` you now have to use `dep deploy stage=production` and set the stage label in your yml file.
79+
- New format for yml-files which can now also include configuration.
80+
- The `local` is not available any more. Instead `once` and `runLocally` should be used. For theme assets the example
81+
uses a function callback and the `on` helper to optionally run those build tasks on the local host.
82+
- When deploying you can't select a host by name or stage anymore. Instead you have to use labels (eg a `stage`
83+
label). If you've used `dep deploy production` you now have to use `dep deploy stage=production` and set the stage
84+
label in your yml file.
3485
- Switched to a single base recipe which can be included and built upon. See `examples/deploy.php`.
35-
- The new recipe and examples uses yml-files for project-specific configuration so the `deploy.php` is a dropin file and has no configuration in it.
86+
- The new recipe and examples uses yml-files for project-specific configuration so the `deploy.php` is a dropin file and
87+
has no configuration in it.
3688
- PHP 8 compatibility.
3789
- Fixes issues with rsync flags/options and `'`.
3890

3991
**Upgrading:**
40-
If you've used the default recipe it's probably easiest to copy the new example `deploy.php` and update your yml-file with project-specific configuration. If you have added any other tasks/features to your `deploy.php` make sure you upgrade them too.
41-
If you've used most of the core functions of this library or just the examples, the upgrade should only take a few minutes.
92+
If you've used the default recipe it's probably easiest to copy the new example `deploy.php` and update your yml-file
93+
with project-specific configuration. If you have added any other tasks/features to your `deploy.php` make sure you
94+
upgrade them too.
95+
If you've used most of the core functions of this library or just the examples, the upgrade should only take a few
96+
minutes.

0 commit comments

Comments
 (0)