A GitHub Action to generate a zip archive of a WordPress project using WP-CLI.
Place the following in /.github/workflows/main.yml
on: push
name: 🚀 Build WordPress Plugin on Push
jobs:
build-deploy:
name: 🎉 Build archive
runs-on: ubuntu-latest
steps:
- name: 🚚 Checkout latest code
uses: actions/checkout@v4
- name: 📦 Build Plugin
uses: webshr/deploy-wp-update-server@latest
with:
install-composer: true # optional; defaults to no-dev
composer-no-dev: true # optional; defaults to false
npm-run-build: true # optional; defaults to false
node-version: 20 # optional; defaults to '20.x'
retention-days: 5 # optional; defaults to 30
archive-name: my-plugin # optional; defaults to repository-name
upload-artifact: false # optional; defaults to trueYou can specify files or directories to be excluded from an archive using a .distignore or a .gitattributes file. It's recommended to use a .distignore file, especially for built files in .gitignore. The .gitattributes file is useful for projects that don't run a build step and ensures consistency with files committed to WordPress.org.
.gitignore example:
/.wordpress-org
/.git
/node_modules
.distignore
.gitignore.gitattributes example:
# Directories
/.github export-ignore
# Files
/.gitattributes export-ignore
/.gitignore export-ignore
Add your keys directly to your .yml configuration file or referenced from the Secrets project store.
It is strongly recommended to save sensive credentials as secrets.
| Key Name | Required | Example | Default | Description |
|---|---|---|---|---|
install-composer |
no | true |
false |
Install composer packages before generating archive |
npm-run-build |
no | true |
false |
Run npm run build before generating archive |
node-version |
no | 20 |
18 |
Node version |
retention-days |
no | 3 |
30 |
Number of days to retain the arhive |
archive-name |
no | my-plugin |
repository-name |
Name of the zip archive |
upload-artifact |
no | true |
false |
Opt-out for artifact upload |
This action is inspired by and builds upon the work done in the Generate WordPress Archive and WordPress Plugin Build Zip Actions.
- Official WP-CLI Command documentation for ``wp dist-archive`
This action is licensed under the MIT License.