Skip to content

Commit a2acb4e

Browse files
committed
Merge pull request #25 from SparkPost/simplify
Set up some deployment awesomeness
2 parents a0eb172 + f8796d4 commit a2acb4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+98
-4949
lines changed

readme.md renamed to README.md

File renamed without changes.
File renamed without changes.

deploy.sh

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#! /bin/bash
2+
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
3+
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.
4+
5+
# main config
6+
PLUGINSLUG="sparkpost"
7+
CURRENTDIR=`pwd`
8+
MAINFILE="wordpress-sparkpost.php" # this should be the name of your main php file in the wordpress plugin
9+
10+
# git config
11+
GITPATH="$CURRENTDIR/" # this file should be in the base of your git repository
12+
13+
# svn config
14+
SVNPATH="/tmp/$PLUGINSLUG" # path to a temp SVN repo. No trailing slash required and don't add trunk.
15+
SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG/" # Remote SVN repo on wordpress.org, with trailing slash
16+
SVNUSER="sparkpost" # your svn username
17+
18+
19+
# Let's begin...
20+
echo ".........................................."
21+
echo
22+
echo "Preparing to deploy wordpress plugin"
23+
echo
24+
echo ".........................................."
25+
echo
26+
27+
# Check if subversion is installed before getting all worked up
28+
if ! which svn >/dev/null; then
29+
echo "You'll need to install subversion before proceeding. Exiting....";
30+
exit 1;
31+
fi
32+
33+
# Check version in readme.txt is the same as plugin file after translating both to unix line breaks to work around grep's failure to identify mac line breaks
34+
NEWVERSION1=`grep "^Stable tag:" $GITPATH/readme.txt | awk -F' ' '{print $NF}'`
35+
echo "readme.txt version: $NEWVERSION1"
36+
NEWVERSION2=`grep "^Version:" $GITPATH/$MAINFILE | awk -F' ' '{print $NF}'`
37+
echo "$MAINFILE version: $NEWVERSION2"
38+
39+
if [ "$NEWVERSION1" != "$NEWVERSION2" ]; then echo "Version in readme.txt & $MAINFILE don't match. Exiting...."; exit 1; fi
40+
41+
echo "Versions match in readme.txt and $MAINFILE. Let's proceed..."
42+
43+
if git show-ref --tags --quiet --verify -- "refs/tags/$NEWVERSION1"
44+
then
45+
echo "Version $NEWVERSION1 already exists as git tag. Exiting....";
46+
exit 1;
47+
else
48+
echo "Git version does not exist. Let's proceed..."
49+
fi
50+
51+
cd $GITPATH
52+
echo -e "Enter a commit message for this new version: \c"
53+
read COMMITMSG
54+
git commit -am "$COMMITMSG"
55+
56+
echo "Tagging new version in git"
57+
git tag -a "$NEWVERSION1" -m "Tagging version $NEWVERSION1"
58+
59+
echo "Pushing latest commit to origin, with tags"
60+
git push origin master
61+
git push origin master --tags
62+
63+
echo
64+
echo "Creating local copy of SVN repo ..."
65+
if [ -d $SVNPATH ]; then rm -rf $SVNPATH; fi
66+
svn co $SVNURL $SVNPATH
67+
68+
echo "Clearing svn repo so we can overwrite it"
69+
rm -rf $SVNPATH/trunk/*
70+
rm -rf $SVNPATH/assets/*
71+
72+
echo "Exporting the HEAD of master from git to the trunk of SVN"
73+
git checkout-index -a -f --prefix=$SVNPATH/trunk/
74+
git checkout-index -a -f --prefix=$SVNPATH/ assets/*
75+
rm -rf $SVNPATH/trunk/assets
76+
77+
echo "Ignoring github specific files and deployment script"
78+
svn propset svn:ignore "deploy.sh
79+
README.md
80+
.git
81+
.gitignore" "$SVNPATH/trunk/"
82+
83+
echo "Changing directory to SVN and committing to trunk"
84+
cd $SVNPATH/trunk/
85+
# Add all new files that are not set to be ignored
86+
svn status $SVNPATH | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
87+
svn commit --username=$SVNUSER -m "$COMMITMSG"
88+
89+
#echo "Creating new SVN tag & committing it"
90+
cd $SVNPATH
91+
svn copy trunk/ tags/$NEWVERSION1/
92+
cd $SVNPATH/tags/$NEWVERSION1
93+
svn commit --username=$SVNUSER -m "Tagging version $NEWVERSION1"
94+
95+
#echo "Removing temporary directory $SVNPATH"
96+
rm -rf $SVNPATH/
97+
98+
echo "*** FIN ***"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tags/1.0.0/mailer.class.php

-36
This file was deleted.

tags/1.0.0/readme.txt

-38
This file was deleted.

tags/1.0.0/sparkpost.class.php

-32
This file was deleted.

tags/1.0.0/widget.class.php

-117
This file was deleted.

tags/1.0.0/wordpress-sparkpost.php

-29
This file was deleted.

tags/1.1.0/mailer.class.php

-36
This file was deleted.

0 commit comments

Comments
 (0)