Skip to content

Commit 7dca209

Browse files
authored
Automate publishing Android editor to Meta Horizon store (#138)
1 parent 8a943c3 commit 7dca209

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

build-android/upload-horizon.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
if [ "$#" -ne 2 ]; then
4+
echo "Usage: $0 <version-name> <latest-stable>"
5+
exit 1
6+
fi
7+
8+
VERSION_NAME="$1"
9+
LATEST_STABLE="$2"
10+
11+
BASEDIR="$(pwd)"
12+
13+
source ${BASEDIR}/config.sh
14+
15+
TMPDIR=$(mktemp -d)
16+
cleanup() {
17+
rm -rf "$TMPDIR"
18+
}
19+
trap cleanup EXIT
20+
21+
OVR_PLATFORM_UTIL_DOWNLOAD_URL="https://www.oculus.com/download_app/?id=5159709737372459"
22+
OVR_PLATFORM_UTIL="$TMPDIR/ovr-platform-util"
23+
24+
APK_FILE="${BASEDIR}/out/android/tools/android_editor_horizonos.apk"
25+
NDS_FILE="${BASEDIR}/out/android/tools/android_editor_native_debug_symbols.zip"
26+
NDS_OUTPUT_DIR="$TMPDIR/nds"
27+
28+
STATUS=$(echo "$VERSION_NAME" | sed -e 's/^.*-\([a-z][a-z]*\)[0-9]*$/\1/')
29+
if [ "$STATUS" = "stable" -a "$LATEST_STABLE" = "1" ]; then
30+
HORIZON_STORE_CHANNEL="LIVE"
31+
elif [ "$STATUS" = "dev" ]; then
32+
HORIZON_STORE_CHANNEL="ALPHA"
33+
elif [ "$STATUS" = "beta" ]; then
34+
HORIZON_STORE_CHANNEL="BETA"
35+
elif [ "$STATUS" = "rc" ]; then
36+
HORIZON_STORE_CHANNEL="RC"
37+
else
38+
echo "Unable to determine Horizon store channel from version status: $STATUS" >/dev/stderr
39+
exit 1
40+
fi
41+
42+
mkdir -p "$NDS_OUTPUT_DIR"
43+
(cd "$NDS_OUTPUT_DIR" && unzip "$NDS_FILE")
44+
45+
echo "Downloading ovr-platform-util..."
46+
if ! curl -fL -o "$OVR_PLATFORM_UTIL" "$OVR_PLATFORM_UTIL_DOWNLOAD_URL"; then
47+
exit 1
48+
fi
49+
50+
chmod +x "$OVR_PLATFORM_UTIL"
51+
52+
echo "Uploading $VERSION_NAME to Horizon store on channel $HORIZON_STORE_CHANNEL..."
53+
if ! $OVR_PLATFORM_UTIL upload-quest-build --app-id "$GODOT_ANDROID_HORIZON_APP_ID" --app-secret "$GODOT_ANDROID_HORIZON_APP_SECRET" --apk "$APK_FILE" --channel "$HORIZON_STORE_CHANNEL" --debug-symbols-dir "$NDS_OUTPUT_DIR/arm64-v8a/" --debug-symbols-pattern '*.so'; then
54+
exit 1
55+
fi

config.sh.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,6 @@ export GODOT_ANDROID_SIGN_PASSWORD=''
101101
# Google Cloud Service Account JSON key with access to Play Console upload permissions
102102
# (View app information + Release apps to production and/or testing.)
103103
export GODOT_ANDROID_UPLOAD_JSON_KEY=''
104+
# Horizon Store app ID and secret.
105+
export GODOT_ANDROID_HORIZON_APP_ID=''
106+
export GODOT_ANDROID_HORIZON_APP_SECRET=''

publish-release.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,14 @@ if [ -e "${GODOT_ANDROID_UPLOAD_JSON_KEY}" ]; then
187187
echo "Publishing Android Editor to Play Store..."
188188
sh build-android/upload-playstore.sh ${godot_version}
189189
else
190-
echo "Disabling Android Editor publishing as no valid Play Store JSON key was found."
190+
echo "Disabling Android Editor publishing on the Play Store as no valid Play Store JSON key was found."
191+
fi
192+
193+
if [ ! -z "${GODOT_ANDROID_HORIZON_APP_ID}" ] && [ ! -z "${GODOT_ANDROID_HORIZON_APP_SECRET}" ]; then
194+
echo "Publishing Android Editor to Horizon Store..."
195+
./build-android/upload-horizon.sh ${godot_version} ${latest_stable}
196+
else
197+
echo "Disabling Android Editor publishing on the Horizon Store as config.sh does not define the required data (GODOT_ANDROID_HORIZON_APP_ID, GODOT_ANDROID_HORIZON_SECRET)."
191198
fi
192199

193200
# Godot Android library

0 commit comments

Comments
 (0)