Skip to content

Commit

Permalink
Patch issues with latest Flutter SDK release manifest
Browse files Browse the repository at this point in the history
This may prevent the workflow from installing older release but the fallback script maybe able to take over attempt to download the old release
socheatsok78 committed Dec 13, 2024
1 parent d030cb6 commit c7fdb36
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions action.sh
Original file line number Diff line number Diff line change
@@ -32,10 +32,7 @@ if [ -f "$FLUTTER_RELEASE_MANIFEST_FILE" ]; then
if [[ $FLUTTER_VERSION == "latest" ]]
then
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
__QUERY="select(.hash == \"${FLUTTER_RELEASE_CURRENT}\" and .dart_sdk_arch == \"${ARCH}\")"
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")
@@ -44,16 +41,19 @@ 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}\")"
if [[ $ARCH == "arm64" ]]; then
__QUERY="select(.version == \"${FLUTTER_VERSION}\" and .dart_sdk_arch == \"${ARCH}\")"
fi
__QUERY="select(.version == \"${FLUTTER_VERSION}\" and .dart_sdk_arch == \"${ARCH}\")"
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")

# Set the detected version
FLUTTER_RELEASE_VERSION=$FLUTTER_VERSION
FLUTTER_DOWNLOAD_URL="${FLUTTER_RELEASE_BASE_URL}/${FLUTTER_RELEASE_ARCHIVE}"
fi

# Debug information
echo "::debug::FLUTTER_RELEASE_VERSION=$FLUTTER_RELEASE_VERSION"
echo "::debug::FLUTTER_RELEASE_SHA256=$FLUTTER_RELEASE_SHA256"
echo "::debug::FLUTTER_RELEASE_ARCHIVE=$FLUTTER_RELEASE_ARCHIVE"
else
echo -e "::warning::Flutter SDK release manifest not found. Switched to using default fallback download strategy."
fi

0 comments on commit c7fdb36

Please sign in to comment.