From b176746f3d9b6cd4c0153829e833ed2d5785fa5a Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 7 Oct 2024 02:42:35 +0200 Subject: [PATCH] Update for Godot 4.3 (#149) `editor_settings.tres` is now split per minor version since 4.3. This also updates mono.Dockerfile to match the main Dockerfile. --- .github/workflows/release.yml | 9 +++-- Dockerfile | 36 ++++++++++++------- mono.Dockerfile | 67 ++++++++++++++++++++++++++--------- 3 files changed, 78 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35f1904..6521427 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,14 +24,14 @@ jobs: steps: - uses: actions/checkout@v3 - run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - - name: Login to GitHub Container Registry + - name: Login to GitHub Container Registry uses: docker/login-action@v1.14.1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -58,14 +58,14 @@ jobs: steps: - uses: actions/checkout@v3 - run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - - name: Login to GitHub Container Registry + - name: Login to GitHub Container Registry uses: docker/login-action@v1.14.1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -85,4 +85,3 @@ jobs: RELEASE_NAME=${{ needs.version.outputs.release_name }} ZIP_GODOT_PLATFORM=${{ startsWith( needs.version.outputs.version, '3.' ) && 'linux_headless_64' || 'linux_x86_64' }} FILENAME_GODOT_PLATFORM=${{ startsWith( needs.version.outputs.version, '3.' ) && 'linux_headless.64' || 'linux.x86_64' }} - diff --git a/Dockerfile b/Dockerfile index 5488364..4a16eac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ osslsigncode \ && rm -rf /var/lib/apt/lists/* -ARG GODOT_VERSION="4.2.1" +# When in doubt, see the downloads page: https://downloads.tuxfamily.org/godotengine/ +ARG GODOT_VERSION="4.3" + +# Example values: stable, beta3, rc1, dev2, etc. +# Also change the `SUBDIR` argument below when NOT using stable. ARG RELEASE_NAME="stable" + +# This is only needed for non-stable builds (alpha, beta, RC) +# e.g. SUBDIR "/beta3" +# Use an empty string "" when the RELEASE_NAME is "stable". ARG SUBDIR="" + ARG GODOT_TEST_ARGS="" ARG GODOT_PLATFORM="linux.x86_64" @@ -40,7 +49,7 @@ RUN /opt/butler/bin/butler -V ENV PATH="/opt/butler/bin:${PATH}" -# Download and setup android-sdk +# Download and set up Android SDK to export to Android. ENV ANDROID_HOME="/usr/lib/android-sdk" RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip \ && unzip commandlinetools-linux-*_latest.zip -d cmdline-tools \ @@ -52,19 +61,22 @@ ENV PATH="${ANDROID_HOME}/cmdline-tools/cmdline-tools/bin:${PATH}" RUN yes | sdkmanager --licenses \ && sdkmanager "platform-tools" "build-tools;33.0.2" "platforms;android-33" "cmdline-tools;latest" "cmake;3.22.1" "ndk;25.2.9519653" -# Adding android keystore and settings +# Add Android keystore and settings. RUN keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 \ && mv debug.keystore /root/debug.keystore RUN godot -v -e --quit --headless ${GODOT_TEST_ARGS} -RUN echo 'export/android/android_sdk_path = "/usr/lib/android-sdk"' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/android/debug_keystore = "/root/debug.keystore"' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/android/debug_keystore_user = "androiddebugkey"' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/android/debug_keystore_pass = "android"' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/android/force_system_user = false' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/android/timestamping_authority_url = ""' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/android/shutdown_adb_on_exit = true' >> ~/.config/godot/editor_settings-4.tres +# Godot editor settings are stored per minor version since 4.3. +# `${GODOT_VERSION:0:3}` transforms a string of the form `x.y.z` into `x.y`, even if it's already `x.y` (until Godot 4.9). +RUN echo 'export/android/android_sdk_path = "/usr/lib/android-sdk"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/debug_keystore = "/root/debug.keystore"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/debug_keystore_user = "androiddebugkey"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/debug_keystore_pass = "android"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/force_system_user = false' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/timestamping_authority_url = ""' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/shutdown_adb_on_exit = true' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +# Download and set up rcedit to change Windows executable icons on export. RUN wget https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -O /opt/rcedit.exe -RUN echo 'export/windows/rcedit = "/opt/rcedit.exe"' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/windows/wine = "/usr/bin/wine64-stable"' >> ~/.config/godot/editor_settings-4.tres +RUN echo 'export/windows/rcedit = "/opt/rcedit.exe"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/windows/wine = "/usr/bin/wine64-stable"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres diff --git a/mono.Dockerfile b/mono.Dockerfile index 7abe211..c0ae627 100644 --- a/mono.Dockerfile +++ b/mono.Dockerfile @@ -12,38 +12,43 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ unzip \ wget \ zip \ + openjdk-17-jdk-headless \ + adb \ rsync \ wine64 \ osslsigncode \ && rm -rf /var/lib/apt/lists/* -# When in doubt see the downloads page -# https://downloads.tuxfamily.org/godotengine/ -ARG GODOT_VERSION="3.4.2" +# When in doubt, see the downloads page: https://downloads.tuxfamily.org/godotengine/ +ARG GODOT_VERSION="4.3" -# Example values: stable, beta3, rc1, alpha2, etc. -# Also change the SUBDIR property when NOT using stable +# Example values: stable, beta3, rc1, dev2, etc. +# Also change the `SUBDIR` argument below when NOT using stable. ARG RELEASE_NAME="stable" # This is only needed for non-stable builds (alpha, beta, RC) # e.g. SUBDIR "/beta3" -# Use an empty string "" when the RELEASE_NAME is "stable" +# Use an empty string "" when the RELEASE_NAME is "stable". ARG SUBDIR="" -ARG ZIP_GODOT_PLATFORM="linux_headless_64" -ARG FILENAME_GODOT_PLATFORM="linux_headless.64" -RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/mono/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${ZIP_GODOT_PLATFORM}.zip \ - && wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/mono/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_export_templates.tpz +ARG GODOT_TEST_ARGS="" +ARG GODOT_PLATFORM="linux.x86_64" -RUN mkdir ~/.cache \ +# NOTE: Mono downloads use an underscore instead of a dot between `linux` and `x86_64` in their URL +# and folder name within the ZIP, but not in the binary file name within the ZIP. +ARG GODOT_ZIP_PLATFORM="linux_x86_64" + +RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${GODOT_ZIP_PLATFORM}.zip \ + && wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_export_templates.tpz \ + && mkdir ~/.cache \ && mkdir -p ~/.config/godot \ && mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${RELEASE_NAME}.mono \ - && unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${ZIP_GODOT_PLATFORM}.zip \ - && mv Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${ZIP_GODOT_PLATFORM}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${FILENAME_GODOT_PLATFORM} /usr/local/bin/godot \ - && mv Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${ZIP_GODOT_PLATFORM}/GodotSharp /usr/local/bin/GodotSharp \ + && unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${GODOT_ZIP_PLATFORM}.zip \ + && mv Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${GODOT_ZIP_PLATFORM}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${GODOT_PLATFORM} /usr/local/bin/godot \ + && mv Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${GODOT_ZIP_PLATFORM}/GodotSharp /usr/local/bin/GodotSharp \ && unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_export_templates.tpz \ && mv templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.${RELEASE_NAME}.mono \ - && rm -f Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_export_templates.tpz Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${ZIP_GODOT_PLATFORM}.zip + && rm -f Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_export_templates.tpz Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_${GODOT_ZIP_PLATFORM}.zip ADD getbutler.sh /opt/butler/getbutler.sh RUN bash /opt/butler/getbutler.sh @@ -51,6 +56,34 @@ RUN /opt/butler/bin/butler -V ENV PATH="/opt/butler/bin:${PATH}" +# Download and set up Android SDK to export to Android. +ENV ANDROID_HOME="/usr/lib/android-sdk" +RUN wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip \ + && unzip commandlinetools-linux-*_latest.zip -d cmdline-tools \ + && mv cmdline-tools $ANDROID_HOME/ \ + && rm -f commandlinetools-linux-*_latest.zip + +ENV PATH="${ANDROID_HOME}/cmdline-tools/cmdline-tools/bin:${PATH}" + +RUN yes | sdkmanager --licenses \ + && sdkmanager "platform-tools" "build-tools;33.0.2" "platforms;android-33" "cmdline-tools;latest" "cmake;3.22.1" "ndk;25.2.9519653" + +# Add Android keystore and settings. +RUN keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 \ + && mv debug.keystore /root/debug.keystore + +RUN godot -v -e --quit --headless ${GODOT_TEST_ARGS} +# Godot editor settings are stored per minor version since 4.3. +# `${GODOT_VERSION:0:3}` transforms a string of the form `x.y.z` into `x.y`, even if it's already `x.y` (until Godot 4.9). +RUN echo 'export/android/android_sdk_path = "/usr/lib/android-sdk"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/debug_keystore = "/root/debug.keystore"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/debug_keystore_user = "androiddebugkey"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/debug_keystore_pass = "android"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/force_system_user = false' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/timestamping_authority_url = ""' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/android/shutdown_adb_on_exit = true' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres + +# Download and set up rcedit to change Windows executable icons on export. RUN wget https://github.com/electron/rcedit/releases/download/v2.0.0/rcedit-x64.exe -O /opt/rcedit.exe -RUN echo 'export/windows/rcedit = "/opt/rcedit.exe"' >> ~/.config/godot/editor_settings-4.tres -RUN echo 'export/windows/wine = "/usr/bin/wine64-stable"' >> ~/.config/godot/editor_settings-4.tres +RUN echo 'export/windows/rcedit = "/opt/rcedit.exe"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres +RUN echo 'export/windows/wine = "/usr/bin/wine64-stable"' >> ~/.config/godot/editor_settings-${GODOT_VERSION:0:3}.tres