fix invalid format in Prepare Flutter SDKs
Build RustDesk Android / Build RustDesk Android ARM64 (push) Failing after 36s

This commit is contained in:
2026-09-13 15:49:15 +03:00
parent 5726997179
commit ac78ad6dd4
+85 -7
View File
@@ -338,16 +338,48 @@ jobs:
run: |
set -euxo pipefail
# GNU tar inside this runner/container cannot always restore the
# UID/GID stored in Flutter archives. Flutter uses the system tar
# while filling its cache, so force extraction as the current user.
export TAR_OPTIONS="--no-same-owner"
flutter_version() {
local root="$1"
local version=""
if [ ! -x "${root}/bin/flutter" ]; then
return 1
fi
"${root}/bin/flutter" --version 2>/dev/null |
head -n 1 |
awk '{print $2}'
# The prebuilt SDK directories can be owned by another UID.
# Mark them safe before asking Git for the checked-out tag.
git config --global \
--add safe.directory "${root}" \
>/dev/null 2>&1 \
|| true
# Prefer Git metadata: it is quiet and does not bootstrap/download
# Flutter artifacts just to discover the SDK version.
version="$(
git \
-C "${root}" \
describe \
--tags \
--exact-match \
HEAD \
2>/dev/null \
|| true
)"
if [ -n "${version}" ]; then
printf '%s\n' "${version}"
return 0
fi
# Fallback for an SDK without usable Git metadata.
"${root}/bin/flutter" --version 2>&1 |
sed -n 's/^Flutter \([^ ]*\).*/\1/p' |
head -n 1
}
ensure_flutter() {
@@ -361,10 +393,17 @@ jobs:
[ "$(flutter_version "${preferred}" || true)" = "${version}" ]
); then
root="${preferred}"
echo \
"Using preinstalled ${role} Flutter ${version}: ${root}" \
>&2
else
root="${HOME}/.cache/rustdesk/flutter-${version}"
if [ "$(flutter_version "${root}" || true)" != "${version}" ]; then
echo \
"Installing ${role} Flutter ${version}: ${root}" \
>&2
rm -rf "${root}"
mkdir -p "$(dirname "${root}")"
@@ -372,18 +411,39 @@ jobs:
--branch "${version}" \
--depth 1 \
https://github.com/flutter/flutter.git \
"${root}"
"${root}" \
>&2
else
echo \
"Using cached ${role} Flutter ${version}: ${root}" \
>&2
fi
fi
git config --global \
--add safe.directory "${root}" \
>/dev/null 2>&1 \
|| true
"${root}/bin/flutter" config --no-analytics
"${root}/bin/flutter" precache --android
# IMPORTANT: ensure_flutter is used inside $(...).
# Everything except the final path MUST go to stderr, otherwise
# command output becomes part of *_FLUTTER_ROOT.
"${root}/bin/flutter" \
config \
--no-analytics \
>&2
printf '%s' "${root}"
# Bridge generation only needs the Flutter/Dart toolchain and pub.
# Download Android engine/Gradle artifacts only for the SDK that
# actually builds the APK.
if [ "${role}" = "android" ]; then
"${root}/bin/flutter" \
precache \
--android \
>&2
fi
printf '%s\n' "${root}"
}
BRIDGE_FLUTTER_ROOT="$(
@@ -400,12 +460,30 @@ jobs:
android
)"
# Guard against accidental stdout pollution.
if [ ! -x "${BRIDGE_FLUTTER_ROOT}/bin/flutter" ]; then
echo \
"ERROR: Invalid BRIDGE_FLUTTER_ROOT: ${BRIDGE_FLUTTER_ROOT}" \
>&2
exit 1
fi
if [ ! -x "${ANDROID_FLUTTER_ROOT}/bin/flutter" ]; then
echo \
"ERROR: Invalid ANDROID_FLUTTER_ROOT: ${ANDROID_FLUTTER_ROOT}" \
>&2
exit 1
fi
echo "BRIDGE_FLUTTER_ROOT=${BRIDGE_FLUTTER_ROOT}" \
>> "${GITHUB_ENV}"
echo "ANDROID_FLUTTER_ROOT=${ANDROID_FLUTTER_ROOT}" \
>> "${GITHUB_ENV}"
echo "TAR_OPTIONS=${TAR_OPTIONS}" \
>> "${GITHUB_ENV}"
echo "Bridge Flutter:"
"${BRIDGE_FLUTTER_ROOT}/bin/flutter" --version