@@ -9,18 +9,25 @@ FLUTTER_VERSION=${1:-"latest"}
9
9
FLUTTER_CHANNEL=${2:- " stable" }
10
10
FLUTTER_OS=$OS
11
11
12
+ FLUTTER_RELEASE_URL=" https://storage.googleapis.com/flutter_infra_release/releases"
13
+ FLUTTER_RELEASE_MANIFEST_URL=" https://storage.googleapis.com/flutter_infra_release/releases/releases_$FLUTTER_OS .json"
14
+ FLUTTER_RELEASE_MANIFEST_FILE=" ${RUNNER_TEMP} /flutter_release.json"
15
+
12
16
# Detect the latest version
13
17
if [[ $FLUTTER_VERSION == " latest" ]]
14
18
then
15
- FLUTTER_RELEASE_MANIFEST_URL=" https://storage.googleapis.com/flutter_infra_release/releases/releases_$OS .json"
16
- FLUTTER_RELEASE_MANIFEST_FILE=" ${RUNNER_TEMP} /flutter_release.json"
17
19
echo " Detecting latest version..."
18
20
if curl -fsSL " $FLUTTER_RELEASE_MANIFEST_URL " -o " $FLUTTER_RELEASE_MANIFEST_FILE " ;
19
21
then
20
- CURRENT_RELEASE=$( jq -r " .current_release.${FLUTTER_CHANNEL} " " $FLUTTER_RELEASE_MANIFEST_FILE " )
21
- FLUTTER_VERSION=$( jq -r " .releases | map(select(.hash == \" ${CURRENT_RELEASE} \" )) | .[0].version" " $FLUTTER_RELEASE_MANIFEST_FILE " )
22
- FLUTTER_SHA256=$( jq -r " .releases | map(select(.hash == \" ${CURRENT_RELEASE} \" )) | .[0].sha256" " $FLUTTER_RELEASE_MANIFEST_FILE " )
22
+ FLUTTER_RELEASE_CURRENT=$( jq -r " .current_release.${FLUTTER_CHANNEL} " " $FLUTTER_RELEASE_MANIFEST_FILE " )
23
+ FLUTTER_RELEASE_VERSION=$( jq -r " .releases | map(select(.hash == \" ${FLUTTER_RELEASE_CURRENT} \" )) | .[0].version" " $FLUTTER_RELEASE_MANIFEST_FILE " )
24
+ FLUTTER_RELEASE_SHA256=$( jq -r " .releases | map(select(.hash == \" ${FLUTTER_RELEASE_CURRENT} \" )) | .[0].sha256" " $FLUTTER_RELEASE_MANIFEST_FILE " )
25
+ FLUTTER_RELEASE_ARCHIVE=$( jq -r " .releases | map(select(.hash == \" ${FLUTTER_RELEASE_CURRENT} \" )) | .[0].archive" " $FLUTTER_RELEASE_MANIFEST_FILE " )
23
26
rm " $FLUTTER_RELEASE_MANIFEST_FILE "
27
+
28
+ # Set the detected version
29
+ FLUTTER_VERSION=$FLUTTER_RELEASE_VERSION
30
+ FLUTTER_DOWNLOAD_URL=" ${FLUTTER_RELEASE_URL} /${FLUTTER_RELEASE_ARCHIVE} "
24
31
else
25
32
echo -e " ::error::Failed to detect the latest version."
26
33
exit 1
40
47
FLUTTER_RUNNER_TOOL_CACHE=" ${RUNNER_TOOL_CACHE} /flutter-${RUNNER_OS} -${FLUTTER_VERSION} -${RUNNER_ARCH} "
41
48
FLUTTER_PUB_CACHE=" ${RUNNER_TEMP} /pub-cache"
42
49
43
- # Check if Flutter SDK already exists
44
- # Otherwise download and install
45
- # https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_3.0.2-stable.zip
46
- FLUTTER_RELEASE_URL=" https://storage.googleapis.com/flutter_infra_release/releases"
47
50
48
51
# OS archive file extension
49
52
EXT=" zip"
52
55
EXT=" tar.xz"
53
56
fi
54
57
58
+ # Check if Flutter SDK already exists
59
+ # Otherwise download and install
60
+ # https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_3.0.2-stable.zip
55
61
if [ ! -d " ${FLUTTER_RUNNER_TOOL_CACHE} " ]; then
56
62
FLUTTER_BUILD_OS=$FLUTTER_OS
57
- echo " Installing Flutter SDK version: ${FLUTTER_VERSION} (${FLUTTER_CHANNEL} ) on \" ${OS } _${ARCH} \" ..."
63
+ echo " Installing Flutter SDK version: ${FLUTTER_VERSION} (${FLUTTER_CHANNEL} ) on \" ${FLUTTER_OS } _${ARCH} \" ..."
58
64
59
65
# Linux
60
66
# /stable /linux/ flutter_linux_2.10.2-stable.tar.xz
@@ -77,7 +83,7 @@ if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then
77
83
fi
78
84
79
85
FLUTTER_BUILD=" flutter_${FLUTTER_BUILD_OS} _${FLUTTER_VERSION} -${FLUTTER_CHANNEL} .${EXT} "
80
- FLUTTER_DOWNLOAD_URL=" ${FLUTTER_RELEASE_URL} /${FLUTTER_CHANNEL} /${FLUTTER_OS} /${FLUTTER_BUILD} "
86
+ FLUTTER_DOWNLOAD_URL=${FLUTTER_DOWNLOAD_URL :- " ${FLUTTER_RELEASE_URL} /${FLUTTER_CHANNEL} /${FLUTTER_OS} /${FLUTTER_BUILD} " }
81
87
82
88
echo " Downloading ${FLUTTER_DOWNLOAD_URL} "
83
89
@@ -113,7 +119,7 @@ if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then
113
119
exit 1
114
120
fi
115
121
else
116
- echo " Cache restored Flutter SDK version: ${FLUTTER_VERSION} (${FLUTTER_CHANNEL} ) on \" ${OS } _${ARCH} \" "
122
+ echo " Cache restored Flutter SDK version: ${FLUTTER_VERSION} (${FLUTTER_CHANNEL} ) on \" ${FLUTTER_OS } _${ARCH} \" "
117
123
fi
118
124
119
125
# Configure pub to use a fixed location.
0 commit comments