Ahmad Awais

NAVIGATE


SHARE


Introducing Continuous Deployment for WordPress Plugins with GitHub Actions

Ahmad AwaisAhmad Awais

We live in the age of agile workflows. Git is preferred over FTP. Especially with the advent of JAMstack and services like AWS Amplify and Netlify; 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.

I see dealing with SVN as a DevOps task. 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.

🚀 WP Continuous Deployment#

Use wp-continuous-deployment to set up an instant GitHub to WordPress.org SVN deployment pipeline with incredibly powerful GitHub Actions. A true commit-deploy workflow with complex dev-ops done for you.

So, here it is. I just built one. wp-continuous-deployment is a Node.js based CLI script. It automates everything you need to set up an instant, continuous deployment pipeline with GitHub Actions; for your WordPress plugins.

🌟 Star WP Console Deployment on GitHub & follow Awais to get updates

📟

Install

npx wp-continuous-deployment

⚙️

Usage

❯ BEFORE#

  1. Make sure your plugin is hosted on WordPress.org
  2. Put your WordPress plugin’s code in a GitHub Repo
  3. Clone the GitHub repo in your PC and browse it with command line
  4. Run npx wp-console-deployment in root of the repo, you cloned
npx wp-continuous-deployment

❯ ONE-TIME SETUP#

  • Follow the instructions, set the slug of your plugin which is the last part of the URL, e.g., for my plugin wordpress.org/plugins/cf7-customizer/ the slug is cf7-customizer
  • Add you WordPress.org SVN username/password (it’s the same credentials you use for login.WordPress.org) in your plugin’s GitHub repository settings.
  • Go to https://github.com/owner/repo/settings/secrets make sure to change the owner/repo part.
  1. Click Add New Secret add
    NAME SVN_USERNAME and fill the value with your username
  2. Click Add New Secret again; add
    Name SVN_PASSWORD and fill the value with your password
WP Console Deployment

❯ AFTER#

  1. All your plugin assets must have been downloaded in the .wordpress-org directory automatically
  2. Or go to https://ps.w.org/plugin-slug/ and then assets directory (if it exists) to manually download the assets and place them .wordpress-org directory (commit it to the GitHub repo)

What’s next?#

🌟 Star WP Console Deployment on GitHub & follow Awais to get updates
  • For every commit/push to master your assets & readme will get deployed (provided there are no other files were modified. If other files are changed the build will be canceled)
  • For every new tag/push, a new version of the plugin will be deployed to the WordPress.org SVN repository.
  • So, go ahead, make changes, git commit, and then run: git tag 2.0.0 && git push --tags — considering 2.0.0 is the new version

📝

Changelog

❯ Read the changelog here →

KEY: 📦 NEW, 👌 IMPROVE, 🐛 FIX, 📖 DOC, 🚀 RELEASE, and ✅ TEST

I use Emoji-log, you should try it and simplify your git commits.

📃

License & Conduct

🌟 Star WP Console Deployment on GitHub & follow Awais to get updates

👨‍🏫 Edutainer at VSCode.pro 🎩 An award-winning open-source engineer and developer advocate 🦊 Google Developers Expert for web 🌳 Node.js foundation Community Committee member ✌️ Author of various open-source dev-tools and software libraries used by millions of developers worldwide ⓦ WordPress Core Developer 📣 TEDx Speaker 🙌 Leading developers and publishing technical content for over a decade 😂 Self-confessed tech comedian cracking silly jokes in the JavaScript web and cloud communities 💜 Loves his wife (Maedah) ❯ Learn more about Awais ↣

Say 👋 on Twitter @MrAhmadAwais | Subscribe to the Developers Takeaway!

📨

TheDevTakeaway: Developers' Newsletter!

Takeaway my professional opinion about Open Source, JavaScript/Cloud, Full Stack Development, building a business, growing a family, and everything in between! Delivered to your inbox once a month. 🤣 I'm even funny some times. 👻 I hate spam! Pinky Promise!