WordPress Plugin SVN Script

By: Ryan Kienstra on: October 16, 2014  in: Plugins, Programming

SVN ScriptHere is a script that I use to push my plugin files from the local development file to the wordpress.org plugin repository.

Set your own variables at the top.

Before committing, I like to check:

  • The version numbers in main plugin file ( header and constants )
  • The stable tag in readme.txt ( Changelog and Upgrade Notice )
# Set variables below
plugin_slug='adapter-post-preview' ;
plugin_abbreviation='app' ;
version='1.0.1' ;
local_dir_all_plugins='/example-directory/wordpress/wp-content/plugins' ;
repo_for_all_plugins='/foobar-directory' ;
# End user variables

local_plugin=$local_dir_all_plugins'/'$plugin_slug ;
local_repo=$repo_for_all_plugins'/'$plugin_abbreviation'/repo' ;
commit_message='Committing version '$version ;
is_first_commit=false ;

if [ ! -d $local_repo ] ;
  then mkdir $local_repo ;
fi ;

cd $local_repo ;
if [ ! -d .svn ] ;
  then svn co 'http://plugins.svn.wordpress.org/'$plugin_slug $local_repo ;
is_first_commit=true ;
fi ;

svn mkdir $local_repo'/tags/'$version ;
cp -r $local_plugin'/'* $local_repo'/tags/'$version'/'
svn add 'tags/'$version'/'* ;
echo 'Plugin copied to tag directory. The svn status is now: ' ;
svn stat ;

cp -R $local_plugin'/'* trunk/
if [ $is_first_commit ] ;
  then svn add trunk ;
fi ;
echo 'Plugin copied to trunk. The svn status is now: ' ;
svn stat ;
echo 'Committing to WordPress...' ;
svn ci -m $commit_message ;
  • This field is for validation purposes and should be left unchanged.

Leave a comment

Get Free Updates

  • This field is for validation purposes and should be left unchanged.