Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions .github/workflows/check-sdk-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,45 @@ jobs:
exit 0
fi

# Get latest available versions
# Platform packages now use MAJOR.MINOR versioning (e.g. android-36.1,
# android-37.0). Capture the optional minor component and sort by version
# so we don't truncate "37.0" to a non-existent "platforms;android-37".
LATEST_PLATFORM=$(echo "$PACKAGES" | grep 'platforms;android-' | grep -oP 'android-\K[0-9]+(\.[0-9]+)?' | sort -V | tail -1)
# Get latest available versions.
#
# Platforms must come from the repository manifest, not `sdkmanager --list`:
# preview platforms such as android-37.0 are tagged channel-0 (stable) but
# carry a <codename> element, so they appear in --list as if stable yet
# require the separate Android SDK Preview license at install time, which
# breaks the unattended Docker build. The presence of a <codename> element
# is the reliable preview marker, so we parse the manifest with a real XML
# parser and skip any platform that has one. Versions are MAJOR.MINOR
# (e.g. 36.1, 37.0).
if ! wget -q "https://dl.google.com/android/repository/repository2-3.xml" -O /tmp/android-repo.xml; then
echo "Failed to download SDK repository manifest"
echo "updated=false" >> $GITHUB_OUTPUT
exit 0
fi
LATEST_PLATFORM=$(python3 - /tmp/android-repo.xml <<'PY'
import re, sys, xml.etree.ElementTree as ET

def local(tag): # strip XML namespace, if any
return tag.rsplit('}', 1)[-1]

root = ET.parse(sys.argv[1]).getroot()
best, best_key = '', None
for pkg in root.iter():
if local(pkg.tag) != 'remotePackage' or pkg.get('obsolete') == 'true':
continue
m = re.fullmatch(r'platforms;android-(\d+(?:\.\d+)?)', pkg.get('path', ''))
if not m:
continue
# Skip previews: any descendant <codename> element marks a preview.
if any(local(e.tag) == 'codename' for e in pkg.iter()):
continue
ver = m.group(1)
key = tuple(int(x) for x in ver.split('.'))
if best_key is None or key > best_key:
best, best_key = ver, key
print(best)
PY
)
LATEST_BUILD_TOOLS=$(echo "$PACKAGES" | grep 'build-tools;' | grep -oP 'build-tools;\K[0-9.]+' | sort -V | tail -1)
LATEST_NDK=$(echo "$PACKAGES" | grep -P '^\s+ndk;' | grep -oP 'ndk;\K[0-9.]+' | sort -V | tail -1)

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG VERSION=2.334.0-ubuntu-noble
ARG JAVA_VERSION=21
ARG COMPILE_SDK=37.0
ARG COMPILE_SDK=36.1
ARG BUILD_TOOLS=37.0.0
ARG NDK_VERSION=30.0.14904198
ARG SDK_TOOLS=8512546_latest
Expand Down