We actively maintain five free plugins on WordPress.org, and with maintenance releases shipping every three weeks, that means we frequently find ourselves deploying updates via Subversion (“SVN”), the version control platform used by WordPress.org.
A developer has traditionally managed this process by hand, but we recently decided to automate this process. Enter: SVN Bot. With this tool we can now tag and release new versions of our plugins from the comfort of Slack!
Benefits of Letting a Bot Do All the Hard Work
- The deployment process occurs in a remote server—no need to have a copy of our SVN repositories in a local computer
- If something goes wrong (we accidentally tag the wrong version number, for example, or the bot finds that some plugin files are corrupted), we can revert the entire process and start over again with a single command
- Anyone on the team can now release new versions of plugins
- The entire team can monitor the deployment status via Slack
Anatomy of the Bot
SVN Bot was developed with Botman Studio, an open source PHP chatbot bundled with Laravel, a popular application framework. The bot listens for a specific command on Slack, then sends the user’s input to Jenkins.
Jenkins is a server-based system that does a lot of the actual “work” of SVN Bot: it builds and executes bash scripts that release new versions of our plugins, revert the entire deployment process, or simply check the deployment status.
SVN Bot in Action
Now let’s see how the bot works! Let’s say a user types the following into Slack:
bot svn tag plugin [plugin-name] [version]
With this command, SVN Bot will:
- Create the necessary directories on server
- Check out a working copy of our repository on wordpress.org
- Update it by adding our new version to the tags directory.
We can verify the deployment status with:
bot svn tag status
Now with the new version of the plugin tagged, we are ready to release it!
bot svn release plugin [plugin-name] [version]
When we run this command, SVN Bot will make the new release “go live” by making the necessary updates to the trunk directory and committing the changes.
If we find that there’s something wrong with the new version, we can revert the deployment process with:
bot svn delete plugin [plugin-name] [version]
With this command, SVN Bot will completely remove the selected version from our SVN repository on WordPress.org, making it fast and easy for us to intervene in the unlikely event something goes wrong.
Our release process was ripe for automation. The introduction of SVN Bot will free up the precious time of our human team members, who are now freed up to spend just a little more time focusing on different aspects of the development cycle. It’s just one more step in our drive to bring bug fixes and new functionality to our customers as quickly—and reliably—as possible. 🙂