Do you develop your WordPress plugins on GitHub? Then here’s a treat for you! We’re excited to release a GitHub Action that deploys to the WordPress.org Plugin Repository whenever you tag a new version on GitHub. You’ll be able to manage your entire development lifecycle in GitHub—no more futzing with local Bash scripts or controlling commit/push access in multiple places.
Keep reading for more details about GitHub Actions and how to get set up, but the gist is this: you reference our action in your plugin repo’s workflow file, filtered to only run when a tag is pushed, and set your username/password secrets. After that, each time you tag a new version on GitHub, whether by pushing a Git tag from the command line or making one using the GitHub releases interface, your plugin will be deployed to WordPress.org.
What’s a GitHub Action?
GitHub Actions, announced at GitHub Universe 2018, is a way to automate development workflows using container-based actions. And since they’re on GitHub, they’re shareable and customizable across the open source ecosystem. Workflows can be triggered by GitHub platform events (e.g. push, issue opened, release published), can run a sequence of actions in response, can be written in any language, and can interact with the full GitHub API and any other public API.
If you’re interested in learning more and building your own GitHub Actions, then check out GitHub’s documentation, their pre-built actions, and sign up for the limited public beta of GitHub Actions. For an even more in-depth walkthrough of creating your own GitHub Action, there’s an excellent writeup on CSS-Tricks and an insider’s perspective from Jessie Frazelle.
Let’s do this!
To get started, head to the Actions tab in your Actions-enabled GitHub repo and create a new workflow. You can use the visual editor, or copy and paste the example from our Action’s readme. You will then want to set the
SVN_USERNAME secrets, either in the Action visual editor or in the repository settings. Don’t worry though, these secrets cannot be viewed as plaintext again once you’ve saved them, so you can use your WordPress.org SVN credentials without exposing them to other contributors.
Once that’s all set, every time you push a new tag to GitHub or create one using GitHub’s releases feature, a new version will be deployed to your WordPress.org repository. By default, it will attempt to deploy to a repository with the same slug as your GitHub repo, but this can be customized using the
SLUG environment variable. The deployment does the following:
- Copies WordPress.org-specific assets to the top-level
assetsdirectory in SVN (by default it looks for a
.wordpress-orgsubfolder but this can be customized using the
- Commits all other new, modified, and deleted files to
- Copies the contents of
VERSIONis the name of your tag in Git
This Action is ready to use today for those already in the GitHub Actions beta (request beta access). Note that public repositories are currently only able to trigger Actions on push. Instructions and examples including information about customizations can be found in the readme file. We are also working on more Actions to release soon. Happy plugin deploying!
Want to build amazing websites and tools like this that help web engineers? Do you love being a part of the open-source community? Join our team and help us make the web a better place.