forked from kodi-czsk/repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·98 lines (85 loc) · 2.26 KB
/
release.sh
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
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# taken grom xbmc-czech-sf.net
TOOLS=$(dirname "$0")"/tools"
BUILD_DIR=tmp
PUBLISH_DIR=repo
mkdir -p ${BUILD_DIR}
echo "Updating addon submodules"
git submodule init
git submodule update
git submodule foreach git pull origin master
if [ -z $1 ];
then
echo "use -n to release addons that need it"
exit 0
elif [ "$1" == "-n" ];
then
echo "Determining which addons need to be released"
addons=$(python addons.py | grep Addon | gawk -F' ' '{print $2}')
else
addons=$1
fi
echo "Addons to be released $addons"
echo "Cleaning up *.pyc files.."
find . -name '*.pyc' | xargs rm -f
if [ ! "$addons" ];
then
exit 0
fi
for addonFile in $addons ; do
dirname=$addonFile
if [ ! -f $addonFile/addon.xml ] ; then
#echo "$addonFile/addon.xml does not exist, skipping"
continue
fi
addon_id=$("$TOOLS/get_addon_attribute" "$addonFile/addon.xml" "id")
addon_version=$("$TOOLS/get_addon_attribute" "$addonFile/addon.xml" "version")
if [ -z "$addon_id" ] ; then
echo "Addon id not found!" >&2
exit 1
fi
if [ -z "$addon_version" ] ; then
echo "Addon id not found!" >&2
exit 2
fi
target_dir="$BUILD_DIR/$addon_id"
if [ ! -d "$target_dir" ] ; then
mkdir "$target_dir"
fi
echo "Packing $addon_id $addon_version"
# make package
package="$target_dir/$addon_id-$addon_version.zip"
if [ -e "$package" ] ; then
rm "$package"
fi
zip -FS -q -r "$package" "$dirname" -x "*.py[oc] *.sw[onp]" ".*"
# copy changelog file
changelog=$(ls "$dirname"/[Cc]hangelog.txt)
if [ -f "$changelog" ] ; then
cp "$changelog" "$target_dir"/changelog-$addon_version.txt
fi
# copy icon file
icon="$dirname"/icon.png
if [ -f "$icon" ] ; then
cp "$icon" "$target_dir"/
fi
git stash
git checkout gh-pages
mkdir -p $PUBLISH_DIR/$addon_id
mv $target_dir/* $PUBLISH_DIR/$addon_id/
git add $PUBLISH_DIR/$addon_id
git commit -m "Release $addon_id $addon_version"
git checkout master
git stash pop
done
echo "Regenerate addons.xml"
python repo_generator.py
git stash
git checkout gh-pages
mv tmp/addons.xml* repo
./update-directory-index.sh
git add repo
git commit -m 'Update metadata files'
git checkout master
git stash pop
echo "Done"