Created
April 17, 2015 14:09
Simple WP.org git deploy. No frills, no tags, no BS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# main config | |
PLUGINSLUG=${PWD##*/} # returns basename of current directory | |
CURRENTDIR=`pwd` | |
# configs | |
GITPATH="$CURRENTDIR/" # this file should be in the base of your git repository | |
SVNPATH="/tmp/$PLUGINSLUG" # path to a temp SVN repo. No trailing slash required and don't add trunk. | |
SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG" # Remote SVN repo on wordpress.org, with no trailing slash | |
SVNUSER="jaredatch" # your svn username | |
# Let's begin... | |
echo | |
echo "Preparing to deploy WordPress plugin..." | |
echo | |
cd $GITPATH | |
echo -e "Enter a commit message for this new version: \c" | |
read COMMITMSG | |
echo "Creating local copy of SVN repo ..." | |
svn co $SVNURL $SVNPATH | |
echo "Exporting the HEAD of master from git to the trunk of SVN" | |
git checkout-index -a -f --prefix=$SVNPATH/trunk/ | |
echo "Ignoring github specific files and deployment script" | |
svn propset svn:ignore "deploy.sh | |
README.md | |
.DS_Store | |
.git | |
.gitignore" "$SVNPATH/trunk/" | |
echo "Changing directory to SVN and committing to trunk" | |
cd $SVNPATH/trunk/ | |
# Add all new files that are not set to be ignored | |
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add | |
svn commit --username=$SVNUSER -m "$COMMITMSG" | |
echo "Removing temporary directory $SVNPATH" | |
rm -fr $SVNPATH/ | |
echo "*** Done! ***" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment