Skip to content

Commit 73402a1

Browse files
committed
publish-release: Add support to upload stable builds to GH, Steam, EGS and itch.io
1 parent d2e5eab commit 73402a1

File tree

4 files changed

+183
-29
lines changed

4 files changed

+183
-29
lines changed

build-release.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
set -e
44
export basedir=$(pwd)
55

6+
# Log output to a file automatically.
7+
exec > >(tee -a "out/logs/build-release") 2>&1
8+
69
# Config
710

811
# For signing keystore and password.
@@ -266,13 +269,6 @@ if [ "${build_classical}" == "1" ]; then
266269
zip -q -9 "${reldir}/${binname}.zip" ${binname} ${wrpname}
267270
rm ${binname} ${wrpname}
268271

269-
if [ -d out/windows/steam ]; then
270-
cp out/windows/steam/godot.windows.editor.x86_64.exe ${steamdir}/godot.windows.opt.tools.64.exe
271-
cp out/windows/steam/godot.windows.editor.x86_32.exe ${steamdir}/godot.windows.opt.tools.32.exe
272-
sign_windows ${steamdir}/godot.windows.opt.tools.64.exe
273-
sign_windows ${steamdir}/godot.windows.opt.tools.32.exe
274-
fi
275-
276272
# Templates
277273
cp out/windows/x86_64/templates/godot.windows.template_release.x86_64.exe ${templatesdir}/windows_release_x86_64.exe
278274
cp out/windows/x86_64/templates/godot.windows.template_debug.x86_64.exe ${templatesdir}/windows_debug_x86_64.exe
@@ -312,6 +308,20 @@ if [ "${build_classical}" == "1" ]; then
312308
rm -rf macos_template.app
313309
sign_macos_template ${templatesdir} 0
314310

311+
## Steam (Classical) ##
312+
313+
if [ -d out/windows/steam ]; then
314+
cp out/windows/steam/godot.windows.editor.x86_64.exe ${steamdir}/godot.windows.opt.tools.64.exe
315+
cp out/windows/steam/godot.windows.editor.x86_32.exe ${steamdir}/godot.windows.opt.tools.32.exe
316+
sign_windows ${steamdir}/godot.windows.opt.tools.64.exe
317+
sign_windows ${steamdir}/godot.windows.opt.tools.32.exe
318+
unzip ${reldir}/${godot_basename}_linux.x86_64.zip -d ${steamdir}/
319+
unzip ${reldir}/${godot_basename}_linux.x86_32.zip -d ${steamdir}/
320+
mv ${steamdir}/{${godot_basename}_linux.x86_64,godot.x11.opt.tools.64}
321+
mv ${steamdir}/{${godot_basename}_linux.x86_32,godot.x11.opt.tools.32}
322+
unzip ${reldir}/${godot_basename}_macos.universal -d ${steamdir}/
323+
fi
324+
315325
## Web (Classical) ##
316326

317327
# Editor

build.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ set -e
44

55
OPTIND=1
66

7+
export basedir="$(pwd)"
8+
mkdir -p ${basedir}/out
9+
mkdir -p ${basedir}/out/logs
10+
mkdir -p ${basedir}/mono-glue
11+
12+
# Log output to a file automatically.
13+
exec > >(tee -a "out/logs/build") 2>&1
14+
715
# Config
816

917
# For default registry and number of cores.
@@ -228,11 +236,6 @@ EOF
228236
popd
229237
fi
230238

231-
export basedir="$(pwd)"
232-
mkdir -p ${basedir}/out
233-
mkdir -p ${basedir}/out/logs
234-
mkdir -p ${basedir}/mono-glue
235-
236239
export podman_run="${podman} run -it --rm --env BUILD_NAME=${BUILD_NAME} --env GODOT_VERSION_STATUS=${GODOT_VERSION_STATUS} --env NUM_CORES=${NUM_CORES} --env CLASSICAL=${build_classical} --env MONO=${build_mono} -v ${basedir}/godot-${godot_version}.tar.gz:/root/godot.tar.gz -v ${basedir}/mono-glue:/root/mono-glue -w /root/"
237240
export img_version=$IMAGE_VERSION
238241

config.sh.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,25 @@
1212
# relevant tool in your PATH or an absolute path to run it from.
1313
export PODMAN='podman'
1414

15+
# GitHub token for @GodotBuilder for releases on godotengine/godot-builds,
16+
# can use a long expiry date.
17+
# For stable releases to godotengine/godot, generate a personal token with
18+
# write access to godotengine/godot for use in publish-release.sh.
19+
export GH_TOKEN=''
20+
1521
# Path to a Git clone of https://github.com/godotengine/godot-builds.
1622
# Only used for uploading official releases.
1723
export GODOT_BUILDS_PATH=''
1824

25+
# Path to the directory with the Steam upload setup.
26+
export UPLOAD_STEAM_PATH=''
27+
28+
# Path to the directory with the EGS upload setup.
29+
export UPLOAD_EGS_PATH=''
30+
31+
# Path to the 'butler' binary for upload of stable releases to itch.io.
32+
export UPLOAD_ITCH_BUTLER=''
33+
1934
# SSH hostname to upload Web editor builds to.
2035
# Only used for uploading official releases.
2136
export WEB_EDITOR_HOSTNAME=''

publish-release.sh

Lines changed: 143 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,37 @@
22

33
set -e
44

5+
# Log output to a file automatically.
6+
exec > >(tee -a "out/logs/publish-release") 2>&1
7+
58
# Config
69

7-
# For signing keys, and path to godot-builds repo.
10+
# For upload tools and signing/release keys.
811
source ./config.sh
912

1013
godot_version=""
11-
web_editor_latest=0
14+
latest_stable=0
15+
skip_stable=0
1216

13-
while getopts "h?v:l" opt; do
17+
while getopts "h?v:ls" opt; do
1418
case "$opt" in
1519
h|\?)
1620
echo "Usage: $0 [OPTIONS...]"
1721
echo
1822
echo " -v godot version (e.g: 3.2-stable) [mandatory]"
19-
echo " -l mark web editor as latest"
23+
echo " -l latest stable release (web editor, itch.io, EGS)"
24+
echo " -s don't run stable specific steps"
2025
echo
2126
exit 1
2227
;;
2328
v)
2429
godot_version=$OPTARG
2530
;;
2631
l)
27-
web_editor_latest=1
32+
latest_stable=1
33+
;;
34+
s)
35+
skip_stable=1
2836
;;
2937
esac
3038
done
@@ -34,6 +42,9 @@ if [ -z "${godot_version}" ]; then
3442
exit 1
3543
fi
3644

45+
basedir=$(pwd)
46+
reldir=${basedir}/releases/${godot_version}
47+
3748
# Confirm
3849

3950
IFS=- read version status <<< "${godot_version}"
@@ -46,26 +57,109 @@ case "$choice" in
4657
esac
4758
template_version=${version}.${status}
4859

60+
# Config checks for stable releases.
61+
62+
if [ "${status}" == "stable" -a "${skip_stable}" == "0" ]; then
63+
echo "Publishing a stable release. Checking that configuration is valid to perform stable release specific steps."
64+
65+
read -p "Enter personal access token (GH_TOKEN) for godotengine/godot: " personal_gh_token
66+
if [[ "${personal_gh_token}" != "github_pat_"* ]]; then
67+
echo "Provided personal access token should start with 'github_pat', aborting."
68+
exit 1
69+
fi
70+
71+
if ! gh api repos/godotengine/godot/git/refs/tags | grep -q ${godot_version}; then
72+
echo "The tag '${godot_version}' does not exist in godotengine/godot, aborting."
73+
echo "Push commits and create it manually before running this script."
74+
exit 1
75+
fi
76+
77+
if [ ! -d "${UPLOAD_STEAM_PATH}" ]; then
78+
echo "Invalid config.sh: UPLOAD_STEAM_PATH is not a directory, aborting."
79+
exit 1
80+
fi
81+
82+
if [ "${latest_stable}" == "1" ]; then
83+
if [ ! -d "${UPLOAD_EGS_PATH}" ]; then
84+
echo "Invalid config.sh: UPLOAD_EGS_PATH is not a directory, aborting."
85+
exit 1
86+
fi
87+
if [ ! -x "${UPLOAD_ITCH_BUTLER}" ]; then
88+
echo "Invalid config.sh: UPLOAD_ITCH_BUTLER does not point to an executable, aborting."
89+
exit 1
90+
fi
91+
fi
92+
fi
93+
4994
# Upload to GitHub godot-builds
5095

96+
echo "Uploading release to to godotengine/godot-builds repository."
97+
5198
if [ -z "${GODOT_BUILDS_PATH}" ]; then
5299
echo "Missing path to godotengine/godot-builds clone in config.sh, necessary to upload releases. Aborting."
53100
exit 1
54101
fi
55102

56103
${GODOT_BUILDS_PATH}/tools/upload-github.sh -v ${version} -f ${status}
57104

58-
# Web editor
105+
# Stable release only
59106

60-
scp -P 22 -r web/${template_version} ${WEB_EDITOR_HOSTNAME}:/home/akien/web_editor/
61-
sleep 2
62-
command="sudo mv /home/akien/web_editor/${template_version} /var/www/editor.godotengine.org/public/releases/"
63-
command="${command}; cd /var/www/editor.godotengine.org; sudo chown -R www-data:www-data public/releases/${template_version}"
64-
command="${command}; sudo ./create-symlinks.sh -v ${template_version}"
65-
if [ $web_editor_latest == 1 ]; then
66-
command="${command} -l"
107+
if [ "${status}" == "stable" -a "${skip_stable}" == "0" ]; then
108+
namever=Godot_v${godot_version}
109+
110+
echo "Uploading stable release to main GitHub repository."
111+
112+
export GH_TOKEN=${personal_gh_token}
113+
pushd git
114+
# Get release details from existing godot-builds release.
115+
release_info=$(gh release view ${godot_version} --repo godotengine/godot-builds --json name,body)
116+
release_title=$(echo "$release_info" | jq -r '.name')
117+
release_desc=$(echo "$release_info" | jq -r '.body')
118+
119+
gh release create ${godot_version} --repo godotengine/godot --title "$release_title" --notes "$release_desc"
120+
gh release upload ${godot_version} ${reldir}/[Gg]* ${reldir}/mono/[Gg]*
121+
# Concatenate SHA sums.
122+
cp ${reldir}/SHA512-SUMS.txt .
123+
cat ${reldir}/mono/SHA512-SUMS.txt >> SHA512-SUMS.txt
124+
gh release upload ${godot_version} SHA512-SUMS.txt
125+
rm SHA512-SUMS.txt
126+
popd
127+
128+
echo "Uploading stable release to Steam."
129+
130+
pushd ${UPLOAD_STEAM_PATH}
131+
rm -rf content/bin/[Gg]*
132+
rm -rf content/editor_data/export_templates/*
133+
cp -f ${basedir}/git/*.{md,txt,png,svg} content/
134+
# Steam specific binaries prepared by build-release.sh
135+
cp -r ${basedir}/steam/[Gg]* content/bin/
136+
unzip ${reldir}/${namever}_export_templates.tpz -d content/editor_data/export_templates/
137+
mv content/editor_data/export_templates/{templates,${template_version}}
138+
steam_build/build.sh
139+
popd
140+
141+
if [ "${latest_stable}" == "1" ]; then
142+
echo "Uploading stable release to EGS (latest only)."
143+
144+
pushd ${UPLOAD_EGS_PATH}
145+
rm -rf buildroot-*/*
146+
unzip ${reldir}/${namever}_win64.exe.zip -d buildroot-win64/
147+
unzip ${reldir}/${namever}_win32.exe.zip -d buildroot-win32/
148+
unzip ${reldir}/${namever}_macos.universal.zip -d buildroot-macos/
149+
./upload.sh -v ${godot_version}
150+
popd
151+
152+
echo "Uploading stable release to itch.io (latest only)."
153+
154+
${UPLOAD_ITCH_BUTLER} push ${reldir}/${namever}_linux.x86_64.zip godotengine/godot:linux-64-stable --userversion ${godot_version}
155+
${UPLOAD_ITCH_BUTLER} push ${reldir}/${namever}_linux.x86_32.zip godotengine/godot:linux-32-stable --userversion ${godot_version}
156+
${UPLOAD_ITCH_BUTLER} push ${reldir}/${namever}_win64.exe.zip godotengine/godot:windows-64-stable --userversion ${godot_version}
157+
${UPLOAD_ITCH_BUTLER} push ${reldir}/${namever}_win32.exe.zip godotengine/godot:windows-32-stable --userversion ${godot_version}
158+
${UPLOAD_ITCH_BUTLER} push ${reldir}/${namever}_macos.universal.zip godotengine/godot:osx-64-stable --userversion ${godot_version}
159+
fi
160+
161+
echo "All stable release upload steps done."
67162
fi
68-
ssh -P 22 ${WEB_EDITOR_HOSTNAME} "${command}"
69163

70164
# NuGet packages
71165

@@ -91,8 +185,40 @@ else
91185
echo "Disabling Android library publishing as deps/keystore doesn't exist."
92186
fi
93187

94-
# Stable release only
188+
# Web editor
189+
190+
echo "Uploading web editor... (with retry logic as it can be flaky)"
95191

96-
if [ "${status}" == "stable" ]; then
97-
echo "NOTE: This script doesn't handle yet uploading stable releases to the main GitHub repository, Steam, EGS, and itch.io."
192+
MAX_RETRIES=5
193+
delay=5
194+
195+
retry_command() {
196+
local attempt=1
197+
local cmd=$1
198+
while [ ${attempt} -le ${MAX_RETRIES} ]; do
199+
echo "Attempt ${attempt}: Running command..."
200+
eval "${cmd}" && return 0 # Success
201+
202+
echo "Command failed. Retrying in ${delay} seconds..."
203+
sleep ${delay}
204+
((attempt++))
205+
delay=$((delay * 2)) # Exponential backoff
206+
done
207+
208+
echo "❌ Command failed after ${MAX_RETRIES} attempts."
209+
return 1
210+
}
211+
212+
command="sudo mv /home/akien/web_editor/${template_version} /var/www/editor.godotengine.org/public/releases/"
213+
command="${command}; cd /var/www/editor.godotengine.org; sudo chown -R www-data:www-data public/releases/${template_version}"
214+
command="${command}; sudo ./create-symlinks.sh -v ${template_version}"
215+
if [ "${latest_stable}" == "1" ]; then
216+
echo "Marking web editor build as 'latest'."
217+
command="${command} -l"
98218
fi
219+
220+
retry_command "scp -P 22 -r web/${template_version} ${WEB_EDITOR_HOSTNAME}:/home/akien/web_editor/"
221+
sleep 2
222+
retry_command "ssh -p 22 ${WEB_EDITOR_HOSTNAME} '${command}'"
223+
224+
echo "All publishing steps done. Check out/logs/publish-release to double check that all steps succeeded."

0 commit comments

Comments
 (0)