|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +# Config |
| 6 | + |
| 7 | +# For signing keys, and path to godot-builds repo. |
| 8 | +source ./config.sh |
| 9 | + |
| 10 | +godot_version="" |
| 11 | +web_editor_latest=0 |
| 12 | + |
| 13 | +while getopts "h?v:l" opt; do |
| 14 | + case "$opt" in |
| 15 | + h|\?) |
| 16 | + echo "Usage: $0 [OPTIONS...]" |
| 17 | + echo |
| 18 | + echo " -v godot version (e.g: 3.2-stable) [mandatory]" |
| 19 | + echo " -l mark web editor as latest" |
| 20 | + echo |
| 21 | + exit 1 |
| 22 | + ;; |
| 23 | + v) |
| 24 | + godot_version=$OPTARG |
| 25 | + ;; |
| 26 | + l) |
| 27 | + web_editor_latest=1 |
| 28 | + ;; |
| 29 | + esac |
| 30 | +done |
| 31 | + |
| 32 | +if [ -z "${godot_version}" ]; then |
| 33 | + echo "Mandatory argument -v missing." |
| 34 | + exit 1 |
| 35 | +fi |
| 36 | + |
| 37 | +# Confirm |
| 38 | + |
| 39 | +IFS=- read version status <<< "${godot_version}" |
| 40 | +echo "Publishing Godot ${version} ${status}." |
| 41 | +read -p "Is this correct (y/n)? " choice |
| 42 | +case "$choice" in |
| 43 | + y|Y ) echo "yes";; |
| 44 | + n|N ) echo "No, aborting."; exit 0;; |
| 45 | + * ) echo "Invalid choice, aborting."; exit 1;; |
| 46 | +esac |
| 47 | +template_version=${version}.${status} |
| 48 | + |
| 49 | +# Upload to GitHub godot-builds |
| 50 | + |
| 51 | +if [ -z "${GODOT_BUILDS_PATH}" ]; then |
| 52 | + echo "Missing path to godotengine/godot-builds clone in config.sh, necessary to upload releases. Aborting." |
| 53 | + exit 1 |
| 54 | +fi |
| 55 | + |
| 56 | +${GODOT_BUILDS_PATH}/tools/upload-github.sh -v ${version} -f ${status} |
| 57 | + |
| 58 | +# Web editor |
| 59 | + |
| 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" |
| 67 | +fi |
| 68 | +ssh -P 22 ${WEB_EDITOR_HOSTNAME} "${command}" |
| 69 | + |
| 70 | +# NuGet packages |
| 71 | + |
| 72 | +publish_nuget_packages() { |
| 73 | + for pkg in "$@"; do |
| 74 | + dotnet nuget push $pkg --source "${NUGET_SOURCE}" --api-key "${NUGET_API_KEY}" --skip-duplicate |
| 75 | + done |
| 76 | +} |
| 77 | + |
| 78 | +if [ ! -z "${NUGET_SOURCE}" ] && [ ! -z "${NUGET_API_KEY}" ] && [[ $(type -P "dotnet") ]]; then |
| 79 | + echo "Publishing NuGet packages..." |
| 80 | + publish_nuget_packages out/linux/x86_64/tools-mono/GodotSharp/Tools/nupkgs/*.nupkg |
| 81 | +else |
| 82 | + 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." |
| 83 | +fi |
| 84 | + |
| 85 | +# Godot Android library |
| 86 | + |
| 87 | +if [ -d "deps/keystore" ]; then |
| 88 | + echo "Publishing Android library to MavenCentral..." |
| 89 | + sh build-android/upload-mavencentral.sh |
| 90 | +else |
| 91 | + echo "Disabling Android library publishing as deps/keystore doesn't exist." |
| 92 | +fi |
| 93 | + |
| 94 | +# Stable release only |
| 95 | + |
| 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." |
| 98 | +fi |
0 commit comments