-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·31 lines (24 loc) · 1009 Bytes
/
publish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
function publish() {
local -r matrixItem="$1"
local -r baseImage=$(echo "$matrixItem" | cut -d'@' -f1)
local -r agpVersion=$(echo "$matrixItem" | cut -d'@' -f2)
local -r isLatest=$(echo "$matrixItem" | cut -d'@' -f3)
if [ ! -f METADATA ]; then
wget https://android.googlesource.com/platform/prebuilts/cmdline-tools/+/refs/heads/main/METADATA
fi
local -r downloadUrl=$(grep -Eo 'https?://dl\.google\.com/android/repository/commandlinetools-linux-([[:digit:]]+)_latest\.zip' METADATA)
local -r commandLineToolsRevisionNumber=$(echo "$downloadUrl" | cut -d'_' -f1 | cut -d'-' -f3)
if [[ "$isLatest" == "true" ]]; then
local latestArg="--latest"
else
local latestArg=""
fi
./build.sh --push \
--build-tools-version="${agpVersion}" \
--command-line-tools-version="${commandLineToolsRevisionNumber}" \
--base-image="ubuntu:$baseImage"
${latestArg}
rm -rf METADATA
}
publish $@