From 9a57da9ea61e8faeac9ebd5803177953d8047ff0 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sun, 28 Apr 2024 19:05:41 +0700 Subject: [PATCH] Fix download query with macos_arm64 --- action.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/action.sh b/action.sh index 126125b..7942055 100755 --- a/action.sh +++ b/action.sh @@ -31,8 +31,11 @@ if [ -f "$FLUTTER_RELEASE_MANIFEST_FILE" ]; then # Detect the latest version if [[ $FLUTTER_VERSION == "latest" ]] then - __QUERY="select(.hash == \"${FLUTTER_RELEASE_CURRENT}\" and .dart_sdk_arch == \"${ARCH}\")" FLUTTER_RELEASE_CURRENT=$(jq -r ".current_release.${FLUTTER_CHANNEL}" "$FLUTTER_RELEASE_MANIFEST_FILE") + __QUERY="select(.hash == \"${FLUTTER_RELEASE_CURRENT}\")" + if [[ $ARCH == "arm64" ]]; then + __QUERY="select(.hash == \"${FLUTTER_RELEASE_CURRENT}\" and .dart_sdk_arch == \"${ARCH}\")" + fi FLUTTER_RELEASE_VERSION=$(jq -r ".releases | map(${__QUERY}) | .[0].version" "$FLUTTER_RELEASE_MANIFEST_FILE") FLUTTER_RELEASE_SHA256=$(jq -r ".releases | map(${__QUERY}) | .[0].sha256" "$FLUTTER_RELEASE_MANIFEST_FILE") FLUTTER_RELEASE_ARCHIVE=$(jq -r ".releases | map(${__QUERY}) | .[0].archive" "$FLUTTER_RELEASE_MANIFEST_FILE") @@ -41,7 +44,10 @@ if [ -f "$FLUTTER_RELEASE_MANIFEST_FILE" ]; then FLUTTER_VERSION=$FLUTTER_RELEASE_VERSION FLUTTER_DOWNLOAD_URL="${FLUTTER_RELEASE_BASE_URL}/${FLUTTER_RELEASE_ARCHIVE}" else - __QUERY="select(.version == \"${FLUTTER_VERSION}\" and .dart_sdk_arch == \"${ARCH}\")" + __QUERY="select(.version == \"${FLUTTER_VERSION}\")" + if [[ $ARCH == "arm64" ]]; then + __QUERY="select(.version == \"${FLUTTER_VERSION}\" and .dart_sdk_arch == \"${ARCH}\")" + fi FLUTTER_RELEASE_SHA256=$(jq -r ".releases | map(${__QUERY}) | .[0].sha256" "$FLUTTER_RELEASE_MANIFEST_FILE") FLUTTER_RELEASE_ARCHIVE=$(jq -r ".releases | map(${__QUERY}) | .[0].archive" "$FLUTTER_RELEASE_MANIFEST_FILE")