1+ #! /usr/bin/env bash
2+
3+ if [[ -z " $TRAVIS " ]]; then
4+ echo " Script is only to be run by Travis CI" 1>&2
5+ exit 1
6+ fi
7+
8+ if [[ -z " $WP_PASSWORD " ]]; then
9+ echo " WordPress.org password not set" 1>&2
10+ exit 1
11+ fi
12+
13+ if [[ -z " $TRAVIS_BRANCH " || " $TRAVIS_BRANCH " == " production" ]]; then
14+ echo " Build branch is required and must not be a production" 1>&2
15+ exit 0
16+ fi
17+
18+
19+ PLUGIN=" eduadmin-booking"
20+ PROJECT_ROOT=$TRAVIS_BUILD_DIR
21+ VERSION=" $( cat $PROJECT_ROOT /eduadmin.php | grep Version: | head -1 | cut -d: -f2 | tr -d ' [[:space:]]' ) "
22+
23+ echo " Version: $VERSION of $PLUGIN "
24+
25+ # Remove files not needed in plugin for deployment
26+ rm -f $PROJECT_ROOT /composer.json
27+ rm -f $PROJECT_ROOT /.scrutinizer.yml
28+ rm -f $PROJECT_ROOT /.travis.yml
29+ rm -f $PROJECT_ROOT /CONTRIBUTING.md
30+ rm -f $PROJECT_ROOT /LICENSE.md
31+ rm -f $PROJECT_ROOT /phpunit.xml
32+ rm -f $PROJECT_ROOT /README.md
33+ rm -f $PROJECT_ROOT /.gitignore
34+ rm -fR $PROJECT_ROOT /scripts
35+ rm -fR $PROJECT_ROOT /tests
36+ rm -fR $PROJECT_ROOT /.git
37+ rm -fR $PROJECT_ROOT /wp-tests
38+
39+ # Make sure we are in the project root
40+ cd $PROJECT_ROOT
41+
42+ # Go up one folder
43+ cd ..
44+
45+ # Delete and recreate the deployFolder
46+ rm -fR deployFolder
47+ mkdir deployFolder
48+
49+ # Go into the deployFolder
50+ cd deployFolder
51+
52+ # Clean up any previous svn dir
53+ rm -fR svn
54+
55+ # Checkout the SVN repo
56+ svn co -q " http://svn.wp-plugins.org/$PLUGIN " svn
57+
58+ # Copy our new version of the plugin into trunk
59+ rsync -r -p -v --delete-before $PROJECT_ROOT /* svn/trunk
60+
61+ svn stat svn | grep ' ^?' | awk ' {print $2}' | xargs -I x svn add x@
62+ # Remove deleted files from SVN
63+ svn stat svn | grep ' ^!' | awk ' {print $2}' | xargs -I x svn rm --force x@
64+ svn stat svn
65+
66+ # Commit to SVN
67+ svn ci --no-auth-cache --username $WP_USERNAME --password $WP_PASSWORD svn -m " Committing changes for $VERSION "
68+
69+ # Remove SVN temp dir
70+ rm -fR svn
0 commit comments