Add script to publish releases everywhere

- GitHub godot-builds
- Web editor
- NuGet
- MavenCentral

Still missing instructions for uploading stable releases to stores, etc.
This commit is contained in:
Rémi Verschelde
2024-11-18 15:58:53 +01:00
parent 8c176b460b
commit 1e4dc88253
3 changed files with 107 additions and 62 deletions

View File

@@ -88,46 +88,14 @@ sign_macos_template() {
ssh "${OSX_HOST}" "rm -rf ${_macos_tmpdir}"
}
can_publish_nuget=0
if [ ! -z "${NUGET_SOURCE}" ] && [ ! -z "${NUGET_API_KEY}" ] && [[ $(type -P "dotnet") ]]; then
can_publish_nuget=1
else
echo "Disabling NuGet package publishing as config.sh does not define the required data (NUGET_SOURCE, NUGET_API_KEY), or dotnet can't be found in PATH."
fi
publish_nuget_packages() {
if [ $can_publish_nuget == 0 ]; then
return
fi
for pkg in "$@"; do
dotnet nuget push $pkg --source "${NUGET_SOURCE}" --api-key "${NUGET_API_KEY}" --skip-duplicate
done
}
can_publish_maven=0
if [ ! -d "${basedir}/deps/keystore" ]; then
echo "Disabling Android library publishing as ${basedir}/deps/keystore doesn't exist."
else
can_publish_maven=1
fi
publish_maven_library() {
if [ $can_publish_maven == 0 ]; then
return
fi
sh build-android/upload-mavencentral.sh
}
godot_version=""
templates_version=""
do_cleanup=1
make_tarball=1
build_classical=1
build_mono=1
publish_nuget=0
publish_maven=0
while getopts "h?v:t:b:p:n-:" opt; do
while getopts "h?v:t:b:n-:" opt; do
case "$opt" in
h|\?)
echo "Usage: $0 [OPTIONS...]"
@@ -135,7 +103,6 @@ while getopts "h?v:t:b:p:n-:" opt; do
echo " -v godot version (e.g: 3.2-stable) [mandatory]"
echo " -t templates version (e.g. 3.2.stable) [mandatory]"
echo " -b build target: all|classical|mono|none (default: all)"
echo " -p publish target: all|nuget|maven|none (default: none)"
echo " --no-cleanup disable deleting pre-existing output folders (default: false)"
echo " --no-tarball disable generating source tarball (default: false)"
echo
@@ -157,16 +124,6 @@ while getopts "h?v:t:b:p:n-:" opt; do
build_mono=0
fi
;;
p)
if [ "$OPTARG" == "nuget" ]; then
publish_nuget=1
elif [ "$OPTARG" == "maven" ]; then
publish_maven=1
elif [ "$OPTARG" == "all" ]; then
publish_nuget=1
publish_maven=1
fi
;;
-)
case "${OPTARG}" in
no-cleanup)
@@ -579,22 +536,4 @@ if [ "${build_mono}" == "1" ]; then
fi
# NuGet packages
if [ "${publish_nuget}" == "1" ]; then
echo "Publishing NuGet packages..."
publish_nuget_packages out/linux/x86_64/tools-mono/GodotSharp/Tools/nupkgs/*.nupkg
fi
# Godot Android library
if [ "${publish_maven}" == "1" ]; then
echo "Publishing Android library to MavenCentral..."
publish_maven_library
fi
echo "All editor binaries and templates prepared successfully for release"

View File

@@ -12,6 +12,14 @@
# relevant tool in your PATH or an absolute path to run it from.
export PODMAN='podman'
# Path to a Git clone of https://github.com/godotengine/godot-builds.
# Only used for uploading official releases.
export GODOT_BUILDS_PATH=''
# SSH hostname to upload Web editor builds to.
# Only used for uploading official releases.
export WEB_EDITOR_HOSTNAME=''
# Registry for build containers.
# The default registry is the one used for official Godot builds.
# Note that some of its images are private and only accessible to selected

98
publish-release.sh Executable file
View File

@@ -0,0 +1,98 @@
#!/bin/bash
set -e
# Config
# For signing keys, and path to godot-builds repo.
source ./config.sh
godot_version=""
web_editor_latest=0
while getopts "h?v:l" opt; do
case "$opt" in
h|\?)
echo "Usage: $0 [OPTIONS...]"
echo
echo " -v godot version (e.g: 3.2-stable) [mandatory]"
echo " -l mark web editor as latest"
echo
exit 1
;;
v)
godot_version=$OPTARG
;;
l)
web_editor_latest=1
;;
esac
done
if [ -z "${godot_version}" ]; then
echo "Mandatory argument -v missing."
exit 1
fi
# Confirm
IFS=- read version status <<< "${godot_version}"
echo "Publishing Godot ${version} ${status}."
read -p "Is this correct (y/n)? " choice
case "$choice" in
y|Y ) echo "yes";;
n|N ) echo "No, aborting."; exit 0;;
* ) echo "Invalid choice, aborting."; exit 1;;
esac
template_version=${version}.${status}
# Upload to GitHub godot-builds
if [ -z "${GODOT_BUILDS_PATH}" ]; then
echo "Missing path to godotengine/godot-builds clone in config.sh, necessary to upload releases. Aborting."
exit 1
fi
${GODOT_BUILDS_PATH}/tools/upload-github.sh -v ${version} -f ${status}
# Web editor
scp -P 22 -r web/${template_version} ${WEB_EDITOR_HOSTNAME}:/home/akien/web_editor/
sleep 2
command="sudo mv /home/akien/web_editor/${template_version} /var/www/editor.godotengine.org/public/releases/"
command="${command}; cd /var/www/editor.godotengine.org; sudo chown -R www-data:www-data public/releases/${template_version}"
command="${command}; sudo ./create-symlinks.sh -v ${template_version}"
if [ $web_editor_latest == 1 ]; then
command="${command} -l"
fi
ssh -P 22 ${WEB_EDITOR_HOSTNAME} "${command}"
# NuGet packages
publish_nuget_packages() {
for pkg in "$@"; do
dotnet nuget push $pkg --source "${NUGET_SOURCE}" --api-key "${NUGET_API_KEY}" --skip-duplicate
done
}
if [ ! -z "${NUGET_SOURCE}" ] && [ ! -z "${NUGET_API_KEY}" ] && [[ $(type -P "dotnet") ]]; then
echo "Publishing NuGet packages..."
publish_nuget_packages out/linux/x86_64/tools-mono/GodotSharp/Tools/nupkgs/*.nupkg
else
echo "Disabling NuGet package publishing as config.sh does not define the required data (NUGET_SOURCE, NUGET_API_KEY), or dotnet can't be found in PATH."
fi
# Godot Android library
if [ -d "deps/keystore" ]; then
echo "Publishing Android library to MavenCentral..."
sh build-android/upload-mavencentral.sh
else
echo "Disabling Android library publishing as deps/keystore doesn't exist."
fi
# Stable release only
if [ "${status}" == "stable" ]; then
echo "NOTE: This script doesn't handle yet uploading stable releases to the main GitHub repository, Steam, EGS, and itch.io."
fi