Repository navigation
Expand file tree
/
Copy pathdeploy-to-svn.sh
More file actions
executable file
·86 lines (67 loc) · 2.37 KB
/
Copy pathdeploy-to-svn.sh
File metadata and controls
executable file
·86 lines (67 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
if [ $# -eq 0 ]; then
echo 'Usage: `./deploy-to-svn.sh <tag | HEAD>`'
exit 1
fi
JETPACK_GIT_DIR=$(dirname "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" )
JETPACK_SVN_DIR="/tmp/jetpack"
TARGET=$1
cd $JETPACK_GIT_DIR
# Make sure we don't have uncommitted changes.
if [[ -n $( git status -s --porcelain ) ]]; then
echo "Uncommitted changes found."
echo "Please deal with them and try again clean."
exit 1
fi
if [ "$1" != "HEAD" ]; then
# Make sure we're trying to deploy something that's been tagged. Don't deploy non-tagged.
if [ -z $( git tag | grep "^$TARGET$" ) ]; then
echo "Tag $TARGET not found in git repository."
echo "Please try again with a valid tag."
exit 1
fi
else
read -p "You are about to deploy a change from an unstable state 'HEAD'. This should only be done to update string typos for translators. Are you sure? [y/N]" -n 1 -r
if [[ $REPLY != "y" && $REPLY != "Y" ]]
then
exit 1
fi
fi
git checkout $TARGET
# Prep a home to drop our new files in. Just make it in /tmp so we can start fresh each time.
rm -rf $JETPACK_SVN_DIR
echo "Checking out SVN shallowly to $JETPACK_SVN_DIR"
svn -q checkout https://plugins.svn.wordpress.org/jetpack/ --depth=empty $JETPACK_SVN_DIR
echo "Done!"
cd $JETPACK_SVN_DIR
echo "Checking out SVN trunk to $JETPACK_SVN_DIR/trunk"
svn -q up trunk
echo "Done!"
echo "Checking out SVN tags shallowly to $JETPACK_SVN_DIR/tags"
svn -q up tags --depth=empty
echo "Done!"
echo "Deleting everything in trunk except for .svn directories"
for file in $(find $JETPACK_SVN_DIR/trunk/* -not -path "*.svn*"); do
rm $file 2>/dev/null
done
echo "Done!"
echo "Rsync'ing everything over from Git except for .git stuffs"
rsync -r --exclude='*.git*' $JETPACK_GIT_DIR/* $JETPACK_SVN_DIR/trunk
echo "Done!"
echo "Purging .po files"
rm -f $JETPACK_SVN_DIR/trunk/languages/*.po
echo "Done!"
echo "Purging paths included in .svnignore"
# check .svnignore
for file in $( cat "$JETPACK_GIT_DIR/.svnignore" 2>/dev/null ); do
rm -rf $JETPACK_SVN_DIR/trunk/$file
done
echo "Done!"
# Tag the release.
# svn cp trunk tags/$TARGET
# Change stable tag in the tag itself, and commit (tags shouldn't be modified after comitted)
# perl -pi -e "s/Stable tag: .*/Stable tag: $TARGET/" tags/$TARGET/readme.txt
# svn ci
# Update trunk to point to the freshly tagged and shipped release.
# perl -pi -e "s/Stable tag: .*/Stable tag: $TARGET/" trunk/readme.txt
# svn ci