You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.7 KiB
69 lines
1.7 KiB
#!/bin/sh
|
|
|
|
echo "+ Scraping SDK website for version number"
|
|
|
|
ANDROID_SDK_VERSION=$(curl --silent https://developer.android.com/studio/ | grep -m 1 -oE 'commandlinetools-linux-[0-9]+' | cut -d - -f 3)
|
|
if [ -z "$ANDROID_SDK_VERSION" ]; then
|
|
echo "Version not found"
|
|
exit 1
|
|
fi
|
|
echo "+ Found version $ANDROID_SDK_VERSION"
|
|
|
|
echo "+ Scraping Android repository-12.xml for build tools"
|
|
|
|
BUILD_TOOLS_VERSION=$(curl --silent https://dl.google.com/android/repository/repository-12.xml | grep -oE "build-tools_r[0-9]+\.[0-9]+\.[0-9]+" | cut -f 2 -d r | sort -r | head -n 1)
|
|
if [ -z "$BUILD_TOOLS_VERSION" ]; then
|
|
echo "Version not found"
|
|
exit 1
|
|
fi
|
|
echo "+ Found version $BUILD_TOOLS_VERSION"
|
|
|
|
PLATFORM_VERSION=$(echo $BUILD_TOOLS_VERSION | cut -f 1 -d .)
|
|
echo "+ Assuming platform version $PLATFORM_VERSION"
|
|
|
|
echo "+ Replacing ANDROID_SDK_VERSION in Dockerfile"
|
|
|
|
sed -i "s/ENV ANDROID_SDK_VERSION .*/ENV ANDROID_SDK_VERSION $ANDROID_SDK_VERSION/" \
|
|
Dockerfile \
|
|
ndk/Dockerfile
|
|
|
|
echo "+ Replacing BUILD_TOOLS_VERSION in Dockerfile"
|
|
|
|
sed -i "s/ENV BUILD_TOOLS_VERSION .*/ENV BUILD_TOOLS_VERSION $BUILD_TOOLS_VERSION/" \
|
|
Dockerfile \
|
|
ndk/Dockerfile
|
|
|
|
echo "+ Replacing PLATFORM_VERSION in Dockerfile"
|
|
|
|
sed -i "s/ENV PLATFORM_VERSION .*/ENV PLATFORM_VERSION $PLATFORM_VERSION/" \
|
|
Dockerfile \
|
|
ndk/Dockerfile
|
|
|
|
echo "+ Done!"
|
|
|
|
echo
|
|
|
|
echo "+ Adding changed files"
|
|
|
|
git config user.name "${GITHUB_ACTOR}"
|
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
git add Dockerfile ndk/Dockerfile
|
|
|
|
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
|
|
|
|
echo "+ Committing"
|
|
|
|
git commit -m "Bump SDK version to $ANDROID_SDK_VERSION"
|
|
|
|
echo "+ Tagging"
|
|
|
|
git tag -f $ANDROID_SDK_VERSION
|
|
|
|
echo "+ Pushing"
|
|
|
|
git push -f
|
|
git push --tags -f
|
|
|
|
echo "+ Done!"
|
|
|
|
fi
|