https://github.com/10up/action-wordpress-plugin-deploy
Deploy your plugin to the WordPress.org repository using GitHub Actions
https://github.com/10up/action-wordpress-plugin-deploy
github-actions hacktoberfest wordpress wordpress-deployment
Last synced: 3 months ago
JSON representation
Deploy your plugin to the WordPress.org repository using GitHub Actions
- Host: GitHub
- URL: https://github.com/10up/action-wordpress-plugin-deploy
- Owner: 10up
- License: mit
- Created: 2019-08-22T19:35:26.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2025-06-04T13:39:50.000Z (4 months ago)
- Last Synced: 2025-06-30T21:07:28.693Z (3 months ago)
- Topics: github-actions, hacktoberfest, wordpress, wordpress-deployment
- Language: Shell
- Homepage:
- Size: 152 KB
- Stars: 578
- Watchers: 56
- Forks: 100
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- stars - action-wordpress-plugin-deploy
README
# WordPress.org Plugin Deploy
> Deploy your plugin to the WordPress.org repository using GitHub Actions.
[](#support-level) [](https://github.com/10up/action-wordpress-plugin-deploy/releases/latest) [](https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/LICENSE) [](https://github.com/10up/action-wordpress-plugin-deploy/actions/workflows/test.yml)
This Action commits the contents of your Git tag to the WordPress.org plugin repository using the same tag name. It can exclude files as defined in either `.distignore` or `.gitattributes`, and moves anything from a `.wordpress-org` subdirectory to the top-level `assets` directory in Subversion (plugin banners, icons, and screenshots).
### ☞ For updating the readme and items in the assets directory between releases, please see our [WordPress.org Plugin Readme/Assets Update Action](https://github.com/10up/action-wordpress-plugin-asset-update)
### ☞ Check out our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress)
## Configuration
### Required secrets
* `SVN_USERNAME`
* `SVN_PASSWORD`[Secrets are set in your repository settings](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets). They cannot be viewed once stored.
### Optional environment variables
* `SLUG` - Defaults to the repository name. This is customizable in case your WordPress repository has a different slug or is capitalized differently.
* `VERSION` - Defaults to the tag name. We do not recommend setting this except for testing purposes.
* `ASSETS_DIR` - Defaults to `.wordpress-org`. This is customizable for other locations of WordPress.org plugin repository-specific assets that belong in the top-level `assets` directory (the one on the same level as `trunk`).
* `BUILD_DIR` - Defaults to `false`. Set this flag to the directory where you build your plugins files into, then the action will copy and deploy files from that directory. Both absolute and relative paths are supported. The relative path if provided will be concatenated with the repository root directory. All files and folders in the build directory will be deployed, `.distignore` or `.gitattributes` will be ignored.### Inputs
* `generate-zip` - Defaults to `false`. Generate a ZIP file from the SVN `trunk` directory. Outputs a `zip-path` variable for use in further workflow steps.
* `dry-run` - Defaults to `false`. Set this to `true` if you want to skip the final Subversion commit step (e.g., to debug prior to a non-dry-run commit). `dry-run` - `true` Doesn't require SVN secret.### Outputs
* `zip-path` - The path to the ZIP file generated if `generate-zip` is set to `true`. Fully qualified including the filename, intended for use in further workflow steps such as uploading release assets.
## Excluding files from deployment
If there are files or directories to be excluded from deployment, such as tests or editor config files, they can be specified in either a `.distignore` file or a `.gitattributes` file using the `export-ignore` directive. If a `.distignore` file is present, it will be used; if not, the Action will look for a `.gitattributes` file and barring that, will write a basic temporary `.gitattributes` into place before proceeding so that no Git/GitHub-specific files are included.
`.distignore` is useful particularly when there are built files that are in `.gitignore`, and is a file that is used in [WP-CLI](https://wp-cli.org/). For modern plugin setups with a build step and no built files committed to the repository, this is the way forward. `.gitattributes` is useful for plugins that don't run a build step as a part of the Actions workflow and also allows for GitHub's generated ZIP files to contain the same contents as what is committed to WordPress.org. If you would like to attach a ZIP file with the proper contents that decompresses to a folder name without version number as WordPress generally expects, you can add steps to your workflow that generate the ZIP and attach it to the GitHub release (concrete examples to come).
### Sample baseline files
#### `.distignore`
**Notes:** `.distignore` is for files to be ignored **only**; it does not currently allow negation like `.gitignore`. This comes from its current expected syntax in WP-CLI's [`wp dist-archive` command](https://github.com/wp-cli/dist-archive-command/). It is possible that this Action will allow for includes via something like a `.distinclude` file in the future, or that WP-CLI itself makes a change that this Action will reflect for consistency. It also will need to contain more than `.gitattributes` because that method **also** respects `.gitignore`.
```
/.wordpress-org
/.git
/.github
/node_modules.distignore
.gitignore
```#### `.gitattributes`
```gitattributes
# Directories
/.wordpress-org export-ignore
/.github export-ignore# Files
/.gitattributes export-ignore
/.gitignore export-ignore
```## Example Workflow Files
To get started, you will want to copy the contents of one of [these examples](examples) into `.github/workflows/deploy.yml` and push that to your repository. You are welcome to name the file something else, but it must be in that directory. The usage of `ubuntu-latest` is recommended for compatibility with required dependencies in this Action.
Current set of example workflow files:
* [Deploy on publishing a new release and attach a ZIP file to the release](examples/deploy-on-publishing-a-new-release-and-attach-a-zip-file-to-the-release.yml)
* [Deploy on pushing a new tag](examples/deploy-on-pushing-a-new-tag.yml)**Note**: The following step is required to check out the repository for use during the workflow run:
```
- uses: actions/checkout@v4
```* [Deploy on pushing a new tag and create release with attached ZIP](examples/deploy-on-pushing-a-new-tag-and-create-release-with-attached-zip.yml)
## Contributing
Want to help? Check out our [contributing guidelines](CONTRIBUTING.md) to get started.
## License
Our GitHub Actions are available for use and remix under the MIT license.
## Support Level
**Active:** 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.
## Like what you see?