-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.sh
executable file
·84 lines (76 loc) · 2.64 KB
/
build.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
#!/bin/sh
sdk_name=renpy-$1-sdk
echo "Downloading the specified SDK (${sdk_name})..."
wget -q https://www.renpy.org/dl/$1/${sdk_name}.tar.bz2
clear
echo "Downloaded SDK version (${sdk_name})."
echo "Setting up the specified SDK (${sdk_name})..."
tar -xf ./${sdk_name}.tar.bz2
rm ./${sdk_name}.tar.bz2
mv ./${sdk_name} ../renpy
if [ $4 = "true" ]; then
steam_lib_name=renpy-$1-steam
echo "Downloading Steam lib (${steam_lib_name})..."
wget -q https://www.renpy.org/dl/$1/${steam_lib_name}.zip
clear
echo "Downloaded Steam lib (${steam_lib_name})..."
echo "Adding Steam lib to Renpy"
unzip -qq ./${steam_lib_name} -d ${steam_lib_name}
rsync -a ${steam_lib_name}/ ../renpy
rm -rf ${steam_lib_name} ${steam_lib_name}.zip
fi
# Note: This will be checked regardless of the version of Ren'Py. Caution is
# advised.
if [ -d "$2/old-game" ]; then
echo "old-game directory detected."
if [ -z "$(ls -A "$2/old-game")" ]; then
echo "ERROR: old-game is empty. This will cause incompatibility issues."
echo "For more information on how the old-game directory works and why"
echo "this directory should not be empty, please refer to the documentation"
echo "at: https://www.renpy.org/doc/html/build.html#old-game."
exit 1
fi
fi
if [[ "$(declare -p -- "$3")" == "declare -a "* ]]; then
for i in "${3[@]}"
do
if [ $i == 'android' ]; then
COMMAND="../renpy/renpy.sh ../renpy/launcher android_build $2"
elif [ $i == 'web' ]; then
COMMAND="../renpy/renpy.sh ../renpy/launcher web_build $2"
else
COMMAND="../renpy/renpy.sh ../renpy/launcher distribute --package $i $2"
fi
echo "Building $i"
if $COMMAND; then
built_dir=$(ls | grep '\-dists')
echo dir=$built_dir >> $GITHUB_OUTPUT
echo version=${built_dir%'-dists'} >> $GITHUB_OUTPUT
else
return 1
fi
done
else
case $3 in
pc|win|mac|linux|market)
COMMAND="../renpy/renpy.sh ../renpy/launcher distribute --package $3 $2"
;;
web)
COMMAND="../renpy/renpy.sh ../renpy/launcher web_build $2"
;;
android)
COMMAND="../renpy/renpy.sh ../renpy/launcher android_build $2"
;;
*)
COMMAND="../renpy/renpy.sh ../renpy/launcher distribute $2"
;;
esac
echo "Building the project at $2..."
if $COMMAND; then
built_dir=$(ls | grep '\-dists')
echo dir=$built_dir >> $GITHUB_OUTPUT
echo version=${built_dir%'-dists'} >> $GITHUB_OUTPUT
else
return 1
fi
fi