forked from gerhard/glz_custom_fields
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage
executable file
·42 lines (36 loc) · 907 Bytes
/
package
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
#!/usr/bin/env bash
if [[ -z "$1" ]]
then
echo "The first argument must be the version that will be packaged"
exit 1
fi
version="$1"
export PLUGIN_VERSION="$version"
code="glz_custom_fields-$version"
archives=(tgz zip)
files=(CHANGELOG.md INSTALL.md $code glz_custom_fields)
# prepare plugin code...
php glz_custom_fields.php > "releases/$code" &&
cd releases &&
# re/package plugin
for archive in ${archives[@]}
do
plugin="glz_custom_fields-$version.$archive"
if [[ -e $plugin ]]
then
rm $plugin
fi
case $archive in
(tgz)
echo -e "\n----> Creating $plugin"
tar zcvf $plugin --exclude="*un~" --exclude="*DS_Store" ${files[@]}
;;
(zip)
echo -e "\n ----> Creating $plugin"
zip -r $plugin $code ${files[*]} -x \*un~ \*DS_Store
esac
done &&
# cleanup
rm $code &&
echo -e "\nglz_custom_fields $version successfully packaged\n"
unset PLUGIN_VERSION