-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·71 lines (58 loc) · 1.78 KB
/
release.sh
File metadata and controls
executable file
·71 lines (58 loc) · 1.78 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
#!/bin/bash
file=$(readlink -f "$1")
if [[ ${file: -4} != ".zip" ]]; then
echo "The file $file is not a zip."
exit 1
fi
folder=$(basename "$1")
wd="/tmp/$folder.XXXX"
wd=$(mktemp -d "$wd")
echo "- Extracting free version $file"
cd "/tmp/" || exit
mkdir -p "$wd"
extract="$wd/upload"
if [ ! -f "$file" ]; then
echo "$file doesn't exists"
exit
fi
unzip "$file" -d "$extract" &> /dev/null
cd "$wd" || exit
# Get the plugin root file
rootfile=$(grep -R "WordPress-Plugin-Boilerplate-Powered" . | awk -F: '{print $1}')
# Get plugin version
version=$(grep " * Version:" "$rootfile" | awk -F' ' '{print $NF}')
# Get the domain for WP SVN
wpdomain=$(grep " * Text Domain:" "$rootfile" | awk -F' ' '{print $NF}')
if [ -z "$wpdomain" ]; then
exit 1
fi
if [ -s "$extract/$wpdomain/composer.json" ]; then
cd "$extract/$wpdomain"
echo "- Regenerating composer files!"
composer dumpautoload -o
cd -
fi
echo "- Deploy on SVN started!"
echo "- Wait few minutes for the procedure!"
echo "- Cloning SVN locally"
svn co "https://plugins.svn.wordpress.org/$wpdomain" > /dev/null
echo "- Copying new plugin version on SVN locally"
cp -r "$extract/$wpdomain/." ./"$wpdomain"/trunk
cp -r "./$wpdomain"/trunk/. "$wpdomain"/tags/"$version"
echo "- Deploying new plugin version on SVN remote"
cd "$wpdomain" || exit
# This command force to add all the files, also if they are new
svn add --force * --auto-props --parents --depth infinity -q > /dev/null
eval $(crudini --get --format=sh "$wsd"/config.ini Login)
svn ci -m "tagging version $version" --username $wp_user 2>&1 | grep 'Error running context'
if [[ $? -eq 0 ]]
then
echo "- Deploy of the new free version failed!"
exit 0
else
echo "- Deploy of the new free version done!"
exit 1
fi
cd /tmp/ || exit
rm -fr "./$wd"
echo " "