4shared

10up announced the public availability of two GitHub Actions geared toward WordPress plugin developers yesterday. The first Action allows developers to deploy plugin updates directly to the WordPress.org plugin directory by tagging a release on GitHub. The second Action handles readme file and asset updates.

On November 14, GitHub announced the public launch of their GitHub Actions feature. GitHub Actions are a way for developers to automate workflows from their Git repositories. Actions can also be shared with others, reused across projects, and forked like any other public repository.

Currently, there are over 1,300 GitHub Actions with more being added every day. At least nine of the current Actions are related to WordPress, including an Action to deploy WordPress by rtCamp, but there will certainly be more to come in the future.

With GitHub Actions out of beta, it opens the door for companies like 10up to share their custom workflows and for others to build upon them. It will also be interesting to see what Actions other developers within the WordPress ecosystem release.

The 10up team initially launched their custom Actions for WordPress in March 2019, which was during GitHub Actions beta period. “Everybody has been very positive,” said Helen Hou-Sandí, director of open source initiatives at 10up and WordPress lead developer. “We’ve had a number of people report bugs, request enhancements, and contribute code and documentation. That’s been a really great measure of adoption and attention for me — having people give thoughtful critical feedback and help us improve this tool for everybody.”

Hou-Sandí is interested in seeing other ideas for adding workflows or potentially new Actions from the community. “An example of something we’ve just started doing without writing a whole new Action is generating hook documentation and deploying that to GitHub Pages, which eliminates the need to generate locally, commit manually, and decide on where to host things,” she said.

“Development was actually smoother than I anticipated,” said Hou-Sandí of creating and testing the team’s GitHub Actions. “Maybe because I spent a fairly long time planning and obsessing over potential issues and chose to use Bash.” For testing, she was able to use an inactive plugin repo on WordPress.org. “I’m sure I could have come up with a method to test completely locally, but being able to use actual environments without repercussions was helpful.”

The 10up team has already been deploying plugin updates with the Actions. Hou-Sandí said that she does not think about this in terms of saving time, even though the team is already tagging releases via GitHub.

“What it’s really done for us is, along with well-documented release processes, made it so that anybody can jump in and get a plugin updated or released without worrying about modifying commit permissions or their personal knowledge of SVN,” she said. “This makes it much easier to get releases out especially when it’s an urgent bugfix.”

Deploying and Updating WordPress Plugins

Both of the GitHub Actions created by 10up help ease the pain of deploying plugin updates to the official WordPress plugin directory. They are designed to streamline plugin release management and simplify the process of getting code out to end-users.

WordPress plugin authors must use Subversion (SVN) to commit and tag plugin releases in the directory. Often, this is an issue because Git is the most-used version control system. Some developers have no experience with SVN, and the number of developers unfamiliar with it will likely only grow as Git continues to gain popularity. Even with those who do understand SVN, switching between version control systems can hinder workflows, particularly with larger teams.

With so many WordPress plugin developers using Git, it makes sense to use tools that are a part of their daily workflow rather than jumping into a system only used during releases. That is where both of these GitHub Actions developed by 10up can help.

Adding Actions to a repository is a fairly straightforward process. All repositories have a new “Actions” tab. Developers can create new workflows directly from the Actions page for their repository. When adding a new workflow, it is simply a matter of copying and pasting a particular Action’s code snippet.

Screenshot of adding a GitHub Action workflow.
Adding a custom GitHub workflow.

The WordPress Plugin Deploy Action is for deploying plugin updates directly to the WordPress plugin directory. When developers tag a release on GitHub, it will automatically commit the update to the WordPress.org SVN repository. The Action respects .distignore and .gitattributes for ignoring files that should not be distributed to users. It also allows developers to add their plugin assets to a .wordpress-org folder, which will be committed to the top-level assets directory.

WordPress.org Plugin Readme/Assets Update is a separate Action that allows developers to commit changes to their plugin’s readme or assets. It is useful when plugin authors need to update their plugin’s Tested up to version number or update screenshots, banners, and icons. This Action watches for changes on a specified branch.

Both Actions require developers to set up secret values for their WordPress SVN username and password. Secrets are encrypted data that can be set via a repository’s “Settings > Secrets” screen. The SVN username and password are required so that GitHub can deploy commits to WordPress.org.

Would you like to write for WP Tavern? We are always accepting guest posts from the community and are looking for new contributors. Get in touch with us and let’s discuss your ideas.