-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
101 lines (75 loc) · 2.17 KB
/
entrypoint.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
99
100
101
#!/bin/sh
set -e
# Function definitions
check_for_errors() {
# Check the exit code of the last command
if [ $? -ne 0 ]; then
echo "Godot build failed. Exiting with error. This is the build log:"
cat godot_error.log
exit 1
fi
}
# Move godot templates already installed from the docker image to home
mkdir -v -p ~/.local/share/godot/export_templates
cp -a /root/.local/share/godot/export_templates/4.3.stable.mono ~/.local/share/godot/export_templates/4.3.stable.mono
# Verify/print the dotnet installation
if [ "$7" = "true" ]
then
echo "Installed Dotnet SDK version:"
dotnet --version
echo "Installed Mono version:"
mono --version
echo "Installed dotnet runtimes:"
dotnet --info
fi
# Set the subdirectory location, if provided
if [ "$3" != "" ]
then
SubDirectoryLocation="$3/"
fi
# Set the export mode, based on the debug flag parameter
mode="export-release"
if [ "$6" = "true" ]
then
echo "Exporting in debug mode!"
mode="export-debug"
fi
# Export
echo "Building $1 for $2"
mkdir -p $GITHUB_WORKSPACE/build/${SubDirectoryLocation:-""}
cd "$GITHUB_WORKSPACE/$5"
# Set up files required for the build
echo "Setting up editor files required for the build"
if [ "$8" = "true" ]
then
godot --headless --verbose --editor --quit-after 60 . 2> godot_error.log
else
godot --headless --editor --quit-after 60 . 2> godot_error.log
fi
check_for_errors
# Build the project
echo "Building the project"
output_file="$GITHUB_WORKSPACE/build/${SubDirectoryLocation:-""}$1"
if [ "$9" = "true" ]; then
output_file="${output_file}.exe"
fi
if [ "$8" = "true" ]
then
godot --headless --verbose --${mode} "$2" "$output_file" 2> godot_error.log
else
godot --headless --${mode} "$2" "$output_file" 2> godot_error.log
fi
check_for_errors
echo "Build Done"
echo build=build/${SubDirectoryLocation:-""} >> $GITHUB_OUTPUT
# Pack the build, if requested
if [ "$4" = "true" ]
then
echo "Packing Build"
mkdir -p $GITHUB_WORKSPACE/package
cd $GITHUB_WORKSPACE/build
zip $GITHUB_WORKSPACE/package/artifact.zip ${SubDirectoryLocation:-"."} -r
echo artifact=package/artifact.zip >> $GITHUB_OUTPUT
echo "Done"
fi
exit 0