Skip to content

Commit d282fdf

Browse files
committed
v2.0.0: Update for Deployer 7
1 parent 84bf2a7 commit d282fdf

28 files changed

+566
-1363
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/vendor/
2+
/test

README.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ A collection of [Deployer](https://deployer.org) Tasks/Recipes to deploy WordPre
2929
- [Simple - `deploy-simple.php`](#simple---deploy-simplephp)
3030
- [Custom Theme](#custom-theme-1)
3131
- [Custom MU-Plugin](#custom-mu-plugin-1)
32+
- [Changelog](#changelog)
33+
- [v2.0.0](#v200)
3234
- [Contributing](#contributing)
3335
- [Built by](#built-by)
3436

@@ -78,7 +80,7 @@ My [Vanilla WordPress Boilerplate](https://github.com/gaambo/vanilla-wp/) puts t
7880

7981
### wp-config.php
8082

81-
To make WordPress deployable you need to extract the host-dependent configuration (eg database access) into a seperate file which does not live in your git repository and is not deployed. I suggest using a **`wp-config-local.php`** file. This file should be required in your `wp-config.php` and be ignored by git (via `.gitignore`). This way `wp-config.php` can (should) be in your git repository and also be deployed. The default `wp/filters` configuration assumes this.
83+
To make WordPress deployable you need to extract the host-dependent configuration (eg database access) into a seperate file which does not live in your git repository and is not deployed. I suggest using a **`wp-config-local.php`** file. This file should be required in your `wp-config.php` and be ignored by git (via `.gitignore`). This way `wp-config.php` can (should) be in your git repository and also be deployed. The default `wp/filter` configuration assumes this.
8284
Another advantage of using a `wp-config-local.php` is to set `WP_DEBUG` on a per host basis.
8385

8486
### Rsync filters/excludes/includes
@@ -103,7 +105,7 @@ This can be handy to put int your custom theme or mu-plugin - for example:
103105
- package-lock.json
104106
```
105107

106-
This prevents any development files/development tools from syncing. I strongly recommend you put something like this in your custom theme and mu-plugins or overwrite any of the `themes/filters` or `mu-plugins/filters` configurations.
108+
This prevents any development files/development tools from syncing. I strongly recommend you put something like this in your custom theme and mu-plugins or overwrite any of the `themes/filter` or `mu-plugins/filter` configurations.
107109

108110
## Tasks
109111

@@ -130,7 +132,7 @@ You can also run `dep --list` to see all available tasks and their description.
130132
- `theme:assets:build`: Run theme assets (npm) build script, can be run locally or remote
131133
- `theme:assets`: A combined tasks to build theme assets - combines `theme:assets:vendors` and `theme:assets:build`
132134
- `theme:vendors`: Install theme vendors (composer), can be run locally or remote
133-
- `theme`: A combined tasks to prepare the theme - combines `theme:assets` and `theme:vendors`
135+
- `theme`: A combined task to prepare the theme - combines `theme:assets` and `theme:vendors`
134136
- `themes:push`: Push themes from local to remote
135137
- `themes:pull`: Pull themes from remote to local
136138
- `themes:sync`: Syncs themes between remote and local
@@ -156,7 +158,7 @@ You can also run `dep --list` to see all available tasks and their description.
156158
### MU Plugin Tasks (`tasks/mu-plugins.php`)
157159

158160
- `mu-plugin:vendors`: Install mu-plugin vendors (composer), can be run locally or remote
159-
- `mu-plugin`: A combined tasks - at the moment only runs mu-plugin:vendors task
161+
- `mu-plugin`: A combined tasks to prepare the theme - at the moment only runs mu-plugin:vendors task
160162
- `mu-plugins:push`: Push mu-plugins from local to remote
161163
- `mu-plugins:pull`: Pull mu-plugins from remote to local
162164
- `mu-plugins:sync`: Syncs mu-plugins between remote and local
@@ -169,6 +171,7 @@ You can also run `dep --list` to see all available tasks and their description.
169171
- `wp:push`: Pushes WordPress core files via rsync
170172
- `wp:pull`: Pulls WordPress core files via rsync
171173
- `wp:info`: Runs the --info command via WP CLI - just a helper/test task
174+
- `wp:install-wpcli`: Install the WP-CLI binary manually with the `wp:install-wpcli` task and set the path as `/bin/wp` afterwards.
172175

173176
#### WP-CLI
174177

@@ -189,7 +192,7 @@ Handling and installing the WP-CLI binary can be done in one of multiple ways:
189192
3. Set the `bin/wp` variable path on the host configuration, if WP-CLI is already installed.
190193
4. Install the WP-CLI binary manually with the `wp:install-wpcli` task and set the path as `/bin/wp` afterwards.
191194
You can pass the installPath, binaryFile and sudo usage via CLI:
192-
`dep wp:install-wpcli production -o installPath='{{deploy_path}}/.bin -o binaryFile=wp -o sudo=true`
195+
`dep wp:install-wpcli stage=production -o installPath='{{deploy_path}}/.bin -o binaryFile=wp -o sudo=true`
193196

194197
See [original PR](https://github.com/gaambo/deployer-wordpress/pull/5) for more information.
195198

@@ -211,41 +214,60 @@ Used for standard aka default aka vanilla deployments. By default it assumes the
211214
The recipe contains tasks for building assets for your custom theme, installing the vendors of your custom theme and installing the vendors of your custom mu-plugin (eg site-specific/core-functionality plugin).
212215

213216
The deployment flow is based on the default [Deployer flow](https://deployer.org/docs/flow.html) and assumes a default Deployer directory structure on the remote host.
214-
By default this recipes overwrites the `deploy:update_code` Deployer task to deploy code via rsync instead of git - but you can change that by removing the overwrite. Or you can edit the task to just sync themes (`themes:push`) and mu-plugins (`mu-plugins:push`).
217+
By default this recipes overwrites the `deploy:update_code` Deployer task with a `deploy:push_code` task to deploy code via rsync instead of git - but you can change that by removing the overwrite. Or you can edit the task to just sync themes (`themes:push`) and mu-plugins (`mu-plugins:push`).
215218

216219
#### Custom Theme
217220

218221
Set custom theme name (= directory) in variable `theme/name`.
219-
By default it runs `theme:assets:vendors` and `theme:assets:build` locally and just pushes the built/dist files to the server (--> no need to install Node.js/npm on server). The `theme:assets` task (which groups the two tasks above) is hooked into _before_ `deploy:update_code`.
222+
By default it runs `theme:assets:vendors` and `theme:assets:build` locally and just pushes the built/dist files to the server (--> no need to install Node.js/npm on server). The `theme:assets` task (which groups the two tasks above) is hooked into _before_ `deploy:push_code`.
220223

221-
Installing PHP/composer vendors/dependencies is done on the server. The `theme:vendors` task is therefore hooked into _after_ `deploy:update_code`.
224+
Installing PHP/composer vendors/dependencies is done on the server. The `theme:vendors` task is therefore hooked into _after_ `deploy:push_code`.
222225

223226
#### Custom MU-Plugin
224227

225228
Set custom mu-plugin name (=directory) in variable `mu-plugin/name`.
226-
Installing PHP/composer vendors/dependencies is done on the server. The `mu-plugin:vendors` task is therefore hooked into _after_ `deploy:update_code`.
229+
Installing PHP/composer vendors/dependencies is done on the server. The `mu-plugin:vendors` task is therefore hooked into _after_ `deploy:push_code`.
227230

228231
### Simple - `deploy-simple.php`
229232

230233
A simple task for deploying WordPress Sites on shared hosting via rsync.
231234
This is especially useful in case you can't put directories outside of the document root on your hosting or you don't want (for any reason) atomic deploys.
232235

233236
The deployment flow is based on the default [Deployer flow](https://deployer.org/docs/flow.html) but overwrites/removes some of the default `deploy:*` tasks to not create handle release directories, symlinks etc.
234-
By default this recipes overwrites the `deploy:update_code` Deployer task to deploy code via rsync instead of git - but you can change that by removing the overwrite. Or you can edit the task to just sync themes (`themes:push`) and mu-plugins (`mu-plugins:push`).
237+
By default this recipes overwrites the `deploy:update_code` Deployer task with a `deploy:push_code` task to deploy code via rsync instead of git - but you can change that by removing the overwrite. Or you can edit the task to just sync themes (`themes:push`) and mu-plugins (`mu-plugins:push`).
235238

236239
An important configuration step is to set **deploy_path**, **release_path** and **document_root** on each remote host to the same directory. This way all tasks work as usual and don't require any changes.
237240

238241
#### Custom Theme
239242

240243
Set custom theme name (= directory) in variable `theme/name`.
241-
By default it runs `theme:assets:vendors` and `theme:assets:build` locally and just pushes the built/dist files to the server (--> no need to install Node.js/npm on server). The `theme:assets` task (which groups the two tasks above) is hooked into _before_ `deploy:update_code`.
244+
By default it runs `theme:assets:vendors` and `theme:assets:build` locally and just pushes the built/dist files to the server (--> no need to install Node.js/npm on server). The `theme:assets` task (which groups the two tasks above) is hooked into _before_ `deploy:push_code`.
242245

243-
Installing PHP/composer vendors/dependencies is done on the server. The `theme:vendors` task is therefore hooked into _after_ `deploy:update_code`.
246+
Installing PHP/composer vendors/dependencies is done on the server. The `theme:vendors` task is therefore hooked into _after_ `deploy:push_code`.
244247

245248
#### Custom MU-Plugin
246249

247250
Set custom mu-plugin name (=directory) in variable `mu-plugin/name`.
248-
Installing PHP/composer vendors/dependencies is done on the server. The `mu-plugin:vendors` task is therefore hooked into _after_ `deploy:update_code`.
251+
Installing PHP/composer vendors/dependencies is done on the server. The `mu-plugin:vendors` task is therefore hooked into _after_ `deploy:push_code`.
252+
253+
## Changelog
254+
255+
### v2.0.0
256+
257+
- Updated from Deployer 6.x to 7.x
258+
See [docs](https://deployer.org/docs/7.x/UPGRADE#upgrade-from-6x-to-7x) for more information.
259+
Most notable changes:
260+
- New format for yml-files which can now also include configuration.
261+
- 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.
262+
- 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.
263+
- Switched to a single base recipe which can be included and built upon. See `examples/deploy.php`.
264+
- 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.
265+
- PHP 8 compatibility.
266+
- Fixes issues with rsync flags/options and `'`.
267+
268+
**Upgrading:**
269+
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.
270+
If you've used most of the core functions of this library or just the examples, the upgrade should only take a few minutes.
249271

250272
## Contributing
251273

composer.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{
2-
"name": "gaambo/deployer-wordpress",
3-
"description": "Deployer tasks for deploying WordPress Sites",
4-
"version": "1.4.1",
5-
"type": "library",
6-
"license": "MIT",
7-
"homepage": "https://github.com/gaambo/deployer-wordpress",
8-
"authors": [
9-
{
10-
"name": "Fabian Todt",
11-
"email": "fabian@fabiantodt.at"
2+
"name": "gaambo/deployer-wordpress",
3+
"description": "Deployer tasks for deploying WordPress Sites",
4+
"version": "2.0.0",
5+
"type": "library",
6+
"license": "MIT",
7+
"homepage": "https://github.com/gaambo/deployer-wordpress",
8+
"authors": [
9+
{
10+
"name": "Fabian Todt",
11+
"email": "fabian@fabiantodt.at"
12+
}
13+
],
14+
"require-dev": {},
15+
"require": {
16+
"php": "^8.0|^7.3",
17+
"deployer/deployer": "^7.2"
18+
},
19+
"autoload": {
20+
"files": [
21+
"autoload.php"
22+
]
1223
}
13-
],
14-
"require-dev": {},
15-
"require": {
16-
"php": "^7.0",
17-
"deployer/deployer": "^6.8"
18-
},
19-
"autoload": {
20-
"files": [
21-
"autoload.php"
22-
]
23-
}
2424
}

0 commit comments

Comments
 (0)