Build RunThings WordPress plugin zip files
npm install runthings-wp-buildBuild distribution-ready WordPress plugin zip files.
A simple build tool for WordPress plugins. Originally built for runthings.dev plugins, but works with any plugin following standard WP conventions.
``bash`
npm install -g runthings-wp-build
Run from the root directory of your WordPress plugin:
`bash`
rtp-build [options]
The plugin directory must contain a main plugin file named {plugin-slug}.php (matching the directory name).
| Option | Description |
|--------|-------------|
| --init | Create a default .distignore file in the current directory |--changelog
| | Generate a changelog prompt from commits since last tag and copy to clipboard |-f
| , --force | Overwrite existing release archive (or .distignore with --init) |
| Variable | Required | Description |
|----------|----------|-------------|
| RTP_RELEASE_DIR | No | Base directory for versioned release archives. When set, copies the zip to {RTP_RELEASE_DIR}/{plugin-slug}/releases/v{version}/ |
The following tools must be installed and available in your PATH:
- gitrsync
- zip
- mktemp
- wp
- (WP-CLI)composer
- (optional, only if your plugin uses Composer)pbcopy
- , xclip, or xsel (optional, for --changelog clipboard support)
1. Regenerates Composer autoloader (if vendor/autoload.php exists).pot
2. Generates translation file using WP-CLI with sensible excludes.distignore
3. Creates clean zip excluding development files via RTP_RELEASE_DIR
4. Archives release to versioned directory (if is set)
5. Commits, tags, and pushes the release to git remote
1. Install globally:
`bash`
npm install -g runthings-wp-build
2. In your plugin directory, create the .distignore file:`
bash`
rtp-build --init
3. Review and customise .distignore for your project.
1. Commit your changelog - commit any changelog and upgrade notice changes first, as docs(readme): changelog for v{version}
2. Update version numbers - update all version references (plugin header, readme.txt stable tag, version constants/defines) to the new version. Leave these changes uncommitted.
3. Run the build:
`bash`
rtp-build
This will:
- Generate the .pot filechore(release): deploy v{version}
- Create the distribution zip
- Commit all uncommitted changes with message v{version}
- Create a git tag
- Push the commit and tag to remote
If you have CI/CD automations (e.g., creating GitHub releases, deploying to WordPress.org), trigger them from the tag push event.
Create a .distignore file in your plugin root to specify files/directories to exclude from the build. Uses rsync exclude syntax.
Example:
`Ignore development files
.wordpress-org/
.git/
node_modules/
vendor/
tests/
build/
.distignore
.gitignore
Output
-
build/{plugin-slug}.zip - The distribution-ready zip file
- {RTP_RELEASE_DIR}/{plugin-slug}/releases/v{version}/{plugin-slug}.zip` - Archived release (optional)Matthew Harris @ runthings.dev
github.com/runthings-dev/runthings-wp-build
MIT