Skip to content

Commit 6053032

Browse files
committed
Create deploy-android-template.sh
1 parent 0c1909d commit 6053032

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

scripts/deploy-android-template.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
3+
usage() {
4+
echo "Usage: $0 GODOT_VERSION"
5+
echo ""
6+
echo "Download and install Android build template."
7+
echo "Tip: Call from repo root."
8+
echo ""
9+
echo "Arguments:"
10+
echo " GODOT_VERSION Godot version to install (e.g., 4.2.1-stable)"
11+
echo ""
12+
echo "Example:"
13+
echo " $0 4.5.1-stable"
14+
exit 1
15+
}
16+
17+
# Enable exit on error
18+
set -e
19+
20+
# Parse opts
21+
while [[ $# -gt 0 ]]; do
22+
case $1 in
23+
-h|--help)
24+
usage
25+
;;
26+
-*)
27+
echo "Error: Unknown option '$1'"
28+
echo ""
29+
usage
30+
;;
31+
*)
32+
# First non-option argument is GODOT_VERSION
33+
if [[ -z "$GODOT_VERSION" ]]; then
34+
GODOT_VERSION="$1"
35+
else
36+
echo "Error: Unexpected argument '$1'"
37+
echo ""
38+
usage
39+
fi
40+
shift
41+
;;
42+
esac
43+
done
44+
45+
# Check if required argument is provided
46+
if [[ -z "$GODOT_VERSION" ]]; then
47+
echo "Error: GODOT_VERSION argument is required"
48+
echo ""
49+
usage
50+
fi
51+
52+
echo "Installing Android template for Godot version: $GODOT_VERSION"
53+
54+
# Download Godot templates
55+
archive_file=Godot_v${GODOT_VERSION}_export_templates.tpz
56+
url=https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/${archive_file}
57+
echo "Downloading templates from: $url"
58+
curl -L -o templates.zip "${url}"
59+
60+
echo "Extracting Android source template..."
61+
rm -f exports/android_source.zip
62+
unzip -j templates.zip templates/android_source.zip -d exports/
63+
rm templates.zip
64+
65+
echo "Installing Android Gradle project..."
66+
rm -rf project/android/
67+
mkdir -p project/android/build
68+
unzip exports/android_source.zip -d project/android/build
69+
70+
echo "Adding version metadata..."
71+
echo "../exports/android_source.zip [$(md5sum exports/android_source.zip | cut -d' ' -f1)]" > project/android/.build_version
72+
73+
echo "Android build template deployed successfully!"

0 commit comments

Comments
 (0)