-
Notifications
You must be signed in to change notification settings - Fork 19
/
package.sh
88 lines (71 loc) · 3.14 KB
/
package.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
#!/bin/sh
################################################################################
# This script packages the results of Godot's export process into artifacts
# suitable for uploading to GitHub and itch.io.
#
# Most of Godot's export presets produce two or more files, so this script
# combines them into a zip file. Some exports only produce a single file, so
# those are left alone.
# Calculate the version string from project.godot, trimming off any suffix
# such as '-steam'
version=$(grep "config/version=" project/project.godot | awk -F "[\"-]" '{print $2}')
echo "version=$version"
################################################################################
# Package the windows release
win_export_path="project/export/windows"
win_zip_filename="$win_export_path/turbofat-win-v$version.zip"
win_bat_filename="$win_export_path/turbofat-win-troubleshoot-v$version.bat"
win_bat_template="bin/troubleshoot_bat/turbofat-troubleshoot.bat.template"
# Delete the existing windows bat file
if [ -f "$win_bat_filename" ]; then
echo "Deleting $win_bat_filename"
rm "$win_bat_filename"
fi
# Delete the existing windows zip file
if [ -f "$win_zip_filename" ]; then
echo "Deleting $win_zip_filename"
rm "$win_zip_filename"
fi
# Create the windows bat file
cp "$win_bat_template" "$win_bat_filename"
sed -i "s|##WIN_EXE_FILENAME##|turbofat-win-v$version.exe|g" "$win_bat_filename"
# Assemble the windows zip file
echo "Packaging $win_zip_filename"
zip "$win_zip_filename" "$win_export_path/turbofat-win-v$version.*" "$win_bat_filename" -x "*.zip" -j
################################################################################
# Package the linux release
linux_export_path="project/export/linux-x11"
linux_zip_filename="$linux_export_path/turbofat-linux-v$version.zip"
# Delete the existing linux zip file
if [ -f "$linux_zip_filename" ]; then
echo "Deleting $linux_zip_filename"
rm "$linux_zip_filename"
fi
# Assemble the linux zip file
echo "Packaging $linux_zip_filename"
zip "$linux_zip_filename" "$linux_export_path/turbofat-linux-v$version.*" -x "*.zip" -j
# Enable the +x flag
bin/zip_exec/zip_exec.exe "$linux_zip_filename" turbofat-linux-v$version.x86_64
################################################################################
# Package the html5 release
html5_export_path="project/export/html5"
html5_old_index_filename="$html5_export_path/turbofat.html"
html5_new_index_filename="$html5_export_path/index.html"
html5_zip_filename="$html5_export_path/turbofat-html5-v$version.zip"
# Rename the 'turbofat.html' file to 'index.html', as required by itch.io
if [ -f "$html5_old_index_filename" ]; then
if [ -f "$html5_new_index_filename" ]; then
echo "Deleting $html5_new_index_filename"
rm "$html5_new_index_filename"
fi
echo "Renaming turbofat.html to index.html"
mv "$html5_export_path/turbofat.html" $html5_new_index_filename
fi
# Delete the existing html5 zip file
if [ -f "$html5_zip_filename" ]; then
echo "Deleting $html5_zip_filename"
rm "$html5_zip_filename"
fi
# Assemble the html5 zip file
echo "Packaging $html5_zip_filename"
zip "$html5_zip_filename" "$html5_export_path/*" -x "*.zip" "$html5_export_path/.*" "*.import" -j