Today, Ahmad Awais launched WP Continuous Deployment, a continuous deployment pipeline for updating plugins hosted on WordPress.org via GitHub actions. It is a Node.js-based CLI script that simplifies the process of keeping plugins updated. Developers only need to type out a single line in their terminal or command prompt. Other than setting up a couple of secret keys on GitHub, the script handles everything in just a few moments.
“We live in the age of agile workflows,” wrote Awais in the project announcement. “Developers only want to
git commit && git push and expect their products to be deployed globally…It’s been a minute since I worked on a WordPress project, but for the last year or so, I’ve been fantasizing about a git-based plugin deployments workflow that will allow me to get away from those old SVN repositories finally.”
On November 14, GitHub announced it was rolling out GitHub Actions. Actions are a way for developers to automate workflows from their Git repositories. Developers can share, fork, and reuse them across projects. A few days later, 10up launched two GitHub actions for WordPress plugin developers. These Actions are the basis for WP Continuous Deployment.
10up’s WordPress Plugin Deploy Action handles deploying plugin updates directly to the WordPress plugin directory. The WordPress.org Plugin Readme/Assets Update Action handles committing changes to a plugin’s readme or assets. The WP Continuous Deployment script automatically adds both and sets up appropriate GitHub workflow files for each.
“What I hope to accomplish with WP Continuous Deployment is make it easy for any developer to use the GitHub Actions built by 10up and others and help migrate to this new workflow with a pinch of automation,” said Awais. “Without WP Continuous Deployment, migrating to GitHub Actions for deploying WordPress plugins is a task that requires knowledge of how GitHub Actions work, what files you have to create, what secrets are, and where to put them. We lose a great number of developers that are unable to figure out this step — due to a bulky and dry operational experience.”
The workflow for many WordPress developers today runs directly through Git, primarily with repositories hosted on GitHub. Often, developers expect any committed code to automatically deploy to the places it should go, such as production websites.
The WordPress plugin directory system, which relies on SVN instead of Git, can sometimes be a bottleneck in team workflows. Some teams even have developers who have never used SVN in their careers. It makes sense for teams to use a single system. Doing so leads to fewer bugs and requires fewer resources to train people on a dying version control system.
“We’re not doing anyone a favor by keeping SVN around,” said Awais. “Projects are hiring hundreds of open source developers to make it easy for the developers’ community to interact with their projects. Whereas WordPress — that once held that edge — has started to lag behind by making it hard and impractical to get started with WordPress development. Go pick 100 random students for universities all over the world and ask them to start an open-source project. You’ll be amazed by the majority of them choosing to start with Git and MIT license. And, here in the WordPress community, we ask people to use SVN. That’s impractical and inaccessible for a majority of developers today.”
Awais said that GitHub Actions have allowed his team to shed a lot of dead weight. He originally did not make his GitHub Actions open source because they were specific to his use cases. After trimming the code down, he realized they were not any different from the Actions that 10up had already released.
“I see dealing with SVN as a DevOps task,” he said. “Something web developers should not be concerned with in 2020. Web developers want to build websites. They want to use Git to do that. With JAMstack, everyone has become accustomed to the idea of pushing a git commit and getting the new build/release. That’s why I built WP Continuous Deployment.”
Set up in 1, 2…
When I originally tested 10up’s GitHub Actions last year, there was a small learning curve. I had to figure out what those new workflow files were for and whether I needed to change things. It was not an overly complicated process, but there was a moment of confusion or two.
What Awais’ script does is take those two GitHub Actions one step further and automate nearly all of the setup.
Developers must have Node.js installed on their computer to run the script, which is fairly common today. With a single command of
npx wp-continuous-deployment, the script is installed. It then prompts you to enter your WordPress.org plugin slug to set everything up. Once done, you merely need to create a couple of secret keys on your GitHub repository.
Awais wanted to automate the entire process. However, GitHub does not yet have an API for creating secret keys. Until that happens, it is the only manual step required.
Within two minutes of choosing which repository I wanted to test the script on, I had everything in place and ready to go. Now, I just need to find some time to actually write code for some of my numerous plugins so I can truly put this script to the test. Thus far, things are looking good.
It may finally be possible for me to purge everything related to SVN from my life. That would be a welcome change.