Streamlining WordPress Development with Automated Deployment: SSH + WP-CLI Script
Enhancing efficiency and safety in remote WordPress development workflows
Overview
Deploying updates to WordPress sitesโbe it themes, plugins, or core filesโcan often become a tedious process, especially when done manually. Repeated FTP uploads, plugin reactivations, and backups consume valuable time and introduce potential risks. Recognizing these inefficiencies, I developed a streamlined deployment solution utilizing SSH and WP-CLI, tailored to reduce manual effort and improve workflow speed for WordPress?” target=”_blank” rel=”noopener noreferrer”>WordPress developers.
The Challenge in WordPress?” target=”_blank” rel=”noopener noreferrer”>WordPress Development
Many developers working remotely face repetitive deployment tasks:
- Manual FTP/SFTP file transfers
- Deactivating and reactivating plugins or themes
- Ensuring reliable backups
- Managing version control and rollbacks
These steps, when performed individually, can take several minutes per deployment cycle, hampering productivityโparticularly in fast-paced client environments or local testing scenarios.
Introducing the Automated Deployment Script
To address this, I authored a free, open-source deployment script (available on GitHub) that automates key deployment operations with a single command. Built with accessibility and flexibility in mind, this solution is ideal for approximately 80% of WordPress?” target=”_blank” rel=”noopener noreferrer”>WordPress developers who currently deploy manually.
Key Features
- One-Click Deployment: Push themes/plugins live instantly
- Automatic Backups: Local and remote backups with versioning
- Plugin/Theme Management: Deactivation, update, and reactivation via WP-CLI
- Effective Rollback: Quick restoration to previous versions
- Cross-Platform Compatibility: Works smoothly on Windows WSL, Linux, and macOS
- Workflow Integration: Right-click context menu for faster updates
- Version Management: Increment version numbers effortlessly
- Sample Data Installer: Rapid initial setup for testing environments
- Central Config File: Simplified setup with adjustable parameters
Backup Strategy for Data Safety and Versioning
The script offers multiple backup options, all configurable:
- Local Tarball: Compressed archive stored on the local machine
- Remote Tarball: Backup stored on the server
- Folder Renaming: Each backup tagged with version numbers
- Compression Options: Use of pigz for faster compression, Gzip for stability
- File Handling: Compression performed before remote transfer to optimize speed
Sample backup directory structure:
“`
Local:
โ