Ahmad Awais Launches Script to Automatically Deploy WordPress Plugin Updates

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…

Screenshot of setting up WP Continuous Deployment via the command line.
Running the setup process for WP Continuous Deployment

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. #lifegoals

9

9 responses to “Ahmad Awais Launches Script to Automatically Deploy WordPress Plugin Updates”

  1. This is great, great news! Thanks Ahmad, I’ll certainly check it out!

    Report

  2. Jakub Mikita says:

    Very nice action, certainly needed!

    There’s one con, though – it’s missing the build process. While it will be enough to deploy simpler plugins, it won’t be valid when you have Composer, Sass and ES6 in your project. Unless you upload all the processed files into Git, which is a terrible idea ;)

    This is why we stick to Buddy CI/CD, where we are building dev and prod packages, upload zips into various locations and deploy to SVN. Github actions probably won’t be able to do that in a long time :(

    Report

    • Jakub Mikita says:

      Actually, I have to take back some of my words! I have set up some nice testing workflow for one of my plugins and it’s pretty neat. I just don’t know what about the filesystem and each job. Are they sharing filesystem or not?

      Or “build & deploy zip to FTP” has to be within one job and “build & deploy to SVN” another one?

      Report

      • Ahmad Awais says:

        This is just a basic setup you know — you can build your entire build workflow in there as well. Nothing’s stopping you to do that. I have different kinds of services building and testing things before plugins get deployed.

        Report

  3. Koen Reus says:

    Nice to see something like this in an easy and ready to use package. It took me days -if not weeks- to get this right with CircleCI and bash scripts.

    Report

  4. Ahmad Awais says:

    Thank you, Justin, for writing this piece and sharing the wp-continuous-deployment CLI with everyone.

    I’m happy to see the engagement and thorough feedback, I’ve found a couple of excellent workflows that can make it even easier to replace a WordPress CI/CD pipeline with GitHub Actions.

    I hope to release a couple of new versions with such updates. Feel free to ✭ star the repository for updates on the next versions. https://github.com/ahmadawais/wp-continuous-deployment.

    Peace!

    Report

  5. Rao Abid Ali says:

    That’s cool Awais,
    I shall give it a try.

    just a question, will it deploy to WP repo each time i git push ?

    Report

  6. Ahmad Awais says:

    ^Abid read the docs for that. It will only deploy the README updates if those are the ones that changed since the last tag you pushed. Otherwise, you’ll have to push a new tag to deploy a new version.

    Peace! ✌️

    Report

  7. Abuzar Khan says:

    Thanks, Ahmad for the latest update. Now it will be easy for us to update plugins automatically.

    Report

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: