Skip to content

cwp deploy

shipped 1.0.0
cwp deploy [env] [flags]

Acts on the environment the project makes obvious: the only one it defines, or the one called dev. Name another to act there. A project with several and no dev has to name one.

tree → site

ArgumentWhat it isDefault
[env]environment to write to (default: default_environment in cwp.yml)
FlagWhat it doesDefault
--only <what>narrow to one artifact, or to code for the tracked paths
--forceoverride the refusals a crossing makesoff
--no-backupskip the remote backup taken before the writeon
--deletemirror the tracked paths: also remove remote files that are absent locallyoff
--prunewith —only roles or —only inventory: delete what the file does not listoff
--exactwith —only inventory: pin to the recorded versionsoff
--replacewith —only bricks: overwrite items that already exist instead of skipping themoff
--sensitivedoes nothing since 2.0: credentials never enter the tree, and customCss travels on its ownoff
--skip-in-usewith —only bricks: leave items the site still references in placeoff
--skip-incomplete-fontswith —only bricks: push everything except fonts the tree carries no faces foroff
--keep-superseded-fontswith —only bricks: leave the font files this import replaces in the media libraryoff
--no-snapshotwith —only bricks: skip the local design-system export taken before a replaceon
--overwrite-conflictswith —only content: overwrite posts that changed on the target since cwp last saw themoff
--media <mode>with —only content: attachments the target lacks, upload | require
--publishwith —only content: a post the target does not have yet arrives publishedoff
--status <status>with —only content: set an existing post’s status too
--delete-termswith —only content: remove terms of a declared taxonomy the tree no longer describesoff
--skip-missing-targetswith —only content: drop a menu entry whose target is absent instead of refusingoff
--yesskip the confirmation promptoff
--with-agentwith —dry-run on a host with no shell: install and remove the PHP agent so the plan is realoff

Plus the shared flags --json, -v, --verbose, -q, --quiet and --dry-run.

What it does

Everything cwp push does, and then the remote post-steps: wp cache flush, the record of what this deploy sent, the builder’s own regeneration (for Bricks, the CSS) and the post-deploy hook.

They run whether or not your project tracks any code. They belong to the run, not to the file transfer. The cache is stale because of the pages as much as the files, and a project that carries content and no tracked paths deploys like any other. The record says what moved:

{ "command": "deploy", "items": { "content": 12, "settings": 3, "paths": 1 } }

One factory in the command manifest generates push and deploy. Their arguments, their flags and their guard ladder are the same objects, not two lists that somebody keeps in step. Read cwp push for the guards, the verification and the --delete semantics; all of it applies here unchanged.

Use deploy unless you have a reason not to. push moves the files and leaves the site holding a stale cache and, on Bricks, stale generated CSS. That looks like a deploy that did not work.

Example

cwp deploy dev                  # the ordinary case
cwp deploy prod --force         # prod is protected; --force is required
cwp deploy dev --delete         # make the remote match local exactly

What it does not do

It does not push the database. It does not run the post-steps during a dry run: a dry run runs no hooks at all.

It does not deploy anything outside tracked. If a change needs a plugin that is not there, that is cwp plugins apply.