Feature/update flatpak 2.4 (#13799)

* update flatpak to reflect recent deps changes as well as upgrade runtime to 50

* support building from worktree
This commit is contained in:
SoftFever
2026-05-22 23:52:36 +08:00
committed by GitHub
parent 6f6fc6ddfe
commit f717b46435
6 changed files with 32 additions and 14 deletions

View File

@@ -22,7 +22,7 @@ ARCH="$(uname -m)"
NO_DEBUG_INFO=false
FORCE_PULL=false
FORCE_CLEAN=true
CONTAINER_IMAGE="ghcr.io/flathub-infra/flatpak-github-actions:gnome-49"
CONTAINER_IMAGE="ghcr.io/flathub-infra/flatpak-github-actions:gnome-50"
normalize_arch() {
case "$1" in
@@ -142,6 +142,16 @@ fi
DOCKER_RUN_ARGS=(run --rm -i --privileged)
# When building from a git worktree, $PROJECT_ROOT/.git is a file pointing to the
# main repo's git dir (outside $PROJECT_ROOT). The git commands and flatpak-builder
# inside the container need that path to resolve, so bind-mount the common git dir
# read-only at its original absolute path. No-op for a normal clone.
GIT_COMMON_DIR="$(git -C "$PROJECT_ROOT" rev-parse --path-format=absolute --git-common-dir 2>/dev/null || true)"
if [ -n "$GIT_COMMON_DIR" ] && [ "$GIT_COMMON_DIR" != "$PROJECT_ROOT/.git" ]; then
echo " Git worktree detected; mounting common git dir read-only: $GIT_COMMON_DIR"
DOCKER_RUN_ARGS+=(-v "$GIT_COMMON_DIR":"$GIT_COMMON_DIR":ro)
fi
# Pass build parameters as env vars so the inner script doesn't need
# variable expansion from the outer shell (avoids quoting issues).
echo "=== Starting Flatpak build inside container ==="
@@ -175,8 +185,8 @@ git config --global --add safe.directory '/src/.flatpak-builder/git/*'
# Install required SDK extensions (not pre-installed in the container image)
flatpak install -y --noninteractive --arch="$BUILD_ARCH" flathub \
org.gnome.Platform//49 \
org.gnome.Sdk//49 \
org.gnome.Platform//50 \
org.gnome.Sdk//50 \
org.freedesktop.Sdk.Extension.llvm21//25.08 || true
install_end=$(date +%s)