Files
godot-builder-image/build-windows.sh
Olof Pettersson 4e2d4d0e91
Some checks failed
Publish Builder Images / build-base (push) Successful in 32s
Publish Builder Images / build-windows (push) Failing after 32s
Download file in script with wget instead
2025-12-02 10:54:24 +01:00

64 lines
2.2 KiB
Bash

#!/bin/sh
set -e
# --- Configuration ---
BASE_IMAGE_NAME="godot-builder-base"
WIN_IMAGE_NAME="godot-builder-windows"
# We need the SAME hash logic to find the right base
BASE_HASH=$(sha256sum Dockerfile.base | cut -c 1-8)
BASE_TAG="$REGISTRY/$USERNAME/$BASE_IMAGE_NAME:$BASE_HASH"
# For the Windows image, we still use the Git SHA (passed from workflow)
# because we want a new Windows builder for every code commit.
WIN_TAG="$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:$TAG"
echo "Logging in..."
buildah login -u "$USERNAME" -p "$PASSWORD" --tls-verify=false --storage-driver=vfs "$REGISTRY"
echo "---------------------------------------"
echo "Preparing Base Image..."
echo "---------------------------------------"
# Pull the base (which build-base.sh guaranteed exists)
buildah pull --tls-verify=false --storage-driver=vfs "$BASE_TAG"
# Create the local alias so Dockerfile.windows finds it
# This satisfies: FROM godot-fedora:custom
buildah tag --storage-driver=vfs "$BASE_TAG" "godot-fedora:custom"
# --- Configuration ---
# Match these exactly to what is in your Dockerfile
LLVM_VER="20250528"
LLVM_NAME="llvm-mingw-${LLVM_VER}-ucrt-ubuntu-22.04-x86_64"
TARBALL="${LLVM_NAME}.tar.xz"
DOWNLOAD_URL="https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_VER}/${TARBALL}"
# ... (Login steps remain the same) ...
echo "---------------------------------------"
echo "Pre-downloading LLVM Toolchain..."
echo "---------------------------------------"
# We check if it exists so we don't re-download if the runner cached it
if [ ! -f "$TARBALL" ]; then
echo "Downloading $TARBALL..."
wget "$DOWNLOAD_URL"
else
echo "File already exists. Using cached version."
fi
echo "---------------------------------------"
echo "Building Windows Image..."
echo "---------------------------------------"
buildah build \
--tls-verify=false \
--storage-driver=vfs \
--network=host \
--build-arg img_version=custom \
-f Dockerfile.windows \
-t "$WIN_TAG" \
-t "$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:latest" \
.
echo "Pushing Windows image..."
buildah push --tls-verify=false --storage-driver=vfs "$WIN_TAG"
buildah push --tls-verify=false --storage-driver=vfs "$REGISTRY/$USERNAME/$WIN_IMAGE_NAME:latest"