mirror of
https://github.com/actions/runner-images.git
synced 2025-12-10 11:07:02 +00:00
[ubuntu, macOS] Fix tools version extraction in Install Android SDK scripts (#12911)
This commit is contained in:
@@ -12,9 +12,9 @@ add_filtered_installation_components() {
|
|||||||
local tools_array=("$@")
|
local tools_array=("$@")
|
||||||
|
|
||||||
for item in ${tools_array[@]}; do
|
for item in ${tools_array[@]}; do
|
||||||
# take the last argument after splitting string by ';'' and '-''
|
# Take the last version number that appears after the last '-' or ';'
|
||||||
version=$(echo "${item##*[-;]}")
|
item_version=$(echo "$item" | grep -oE '[-;][0-9.]+' | grep -oE '[0-9.]+')
|
||||||
if [[ "$(printf "${minimum_version}\n${version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then
|
if [[ "$(printf "${minimum_version}\n${item_version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then
|
||||||
components+=($item)
|
components+=($item)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ add_filtered_installation_components() {
|
|||||||
local tools_array=("$@")
|
local tools_array=("$@")
|
||||||
|
|
||||||
for item in ${tools_array[@]}; do
|
for item in ${tools_array[@]}; do
|
||||||
# Take the last argument after splitting string by ';'' and '-''
|
# Take the last version number that appears after the last '-' or ';'
|
||||||
item_version=$(echo "${item##*[-;]}")
|
item_version=$(echo "$item" | grep -oE '[-;][0-9.]+' | grep -oE '[0-9.]+')
|
||||||
|
|
||||||
# Semver 'comparison'. Add item to components array, if item's version is greater than or equal to minimum version
|
# Semver 'comparison'. Add item to components array, if item's version is greater than or equal to minimum version
|
||||||
if [[ "$(printf "${minimum_version}\n${item_version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then
|
if [[ "$(printf "${minimum_version}\n${item_version}\n" | sort -V | head -n1)" == "$minimum_version" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user