I love WordPress and I’m sure it is the best solution for corporate websites and personal blogs. I’m happy to contribute code for WordPress, create plugins and themes. I’ve made a few public plugins: Inline Spoilers and Sanitize Cyrillic.
But there is one unpleasant thing that everytime stopped me. WordPress wants you to use SVN to store and deploy public plugins and themes but development with SVN is too annoying for me. There are topics how to use git for WordPress but it is all about git-svn.
I’m expecting that you already have a submitted WordPress plugin and just want to avoid SVN things, otherwise, please, take a look at this guide and welcome back.
Step 1: Travis CI Configuration
Start with creating ‘dummy’
.travis.yml file in your repository to tell Travis what to do:
Travis will procceed all future commits and pull requests for repository with
Step 2: Configure WordPress Plugin Assets
WordPress has custom
assets/ directory in plugin SVN repository to store plugin page assets such as screenshots, icons, and etc.
assets/ directory and put empty
.gitkeep file into to make sure it exists even without any file inside.
Step 3: Write Deployment Script
🤹♀️ ~ that’s where the magic begins…
To avoid SVN stuff just put it to shell script, create
deploy/deploy.sh script file with next contents:
* Used global variables will be covered a little bit later.
It will do all deployment stuff, you just need to execute this script.
Actually you don’t need to execute script to deploy a new release. Travis will do that for you.
Step 4: Enable Travis CI Deployment
I think you don’t need to deploy each new commit, you need to tell Travis to execute deployment script only on “some” specific events.
I’d prefer using tags to specify plugin releases. I want Travis to submit new plugin version to Wordpress each time I push a new git tag.
To enable deployment on git tags provide next configuration to
* Travis sees git tags the same way as branches.
I like to use semver for projects, I’ve set semver regular expression as a branch filter to allow deployments only for this kind of tags.
$SVN_REPOSITORY - WordPress plugin SVN repository URL.
$TRAVIS_TAG - Tag label. (This variable is fetched and provided by Travis from GitHub)
$SVN_USERNAME - Encrypted WordPress account username.
$SVN_PASSWORD - Encrypted WordPress account password.
Now you have complete setup of automated plugin deployment proccess.
With this way you don’t need to do any SVN specific actions. You may just develop plugins and when you’re ready to give users a new version just push tag for commit you want to deploy. Travis will do all required stuff and after a few minutes you’ll see new deployed version on WordPress website.