From 26aa4d6d23c7aef8ddbf9ed12d3be348b541c284 Mon Sep 17 00:00:00 2001 From: Khurelkhuyag Date: Thu, 19 Oct 2023 18:19:09 +0800 Subject: [PATCH 1/4] Update setup.sh version: latest property support --- setup.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.sh b/setup.sh index 3a70219..edab1ff 100755 --- a/setup.sh +++ b/setup.sh @@ -9,6 +9,12 @@ FLUTTER_VERSION=${1:-3.0.2} FLUTTER_CHANNEL=${2:-stable} FLUTTER_OS=$OS +# Detect the latest version +if [[ $FLUTTER_VERSION == latest ]] +then + FLUTTER_VERSION=$(curl -s https://storage.googleapis.com/flutter_infra_release/releases/releases_$OS.json | jq -r ".releases | map(select(.channel == \"${FLUTTER_CHANNEL}\")) | .[0].version") +fi + # OS archive file extension EXT="zip" if [[ $OS == linux ]] From e1604cf9facdb280b9180f73c4997adb76e51f72 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 21 Oct 2023 09:14:47 +0700 Subject: [PATCH 2/4] Rework "latest" check logic --- setup.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index edab1ff..b2f7034 100755 --- a/setup.sh +++ b/setup.sh @@ -10,9 +10,7 @@ FLUTTER_CHANNEL=${2:-stable} FLUTTER_OS=$OS # Detect the latest version -if [[ $FLUTTER_VERSION == latest ]] -then - FLUTTER_VERSION=$(curl -s https://storage.googleapis.com/flutter_infra_release/releases/releases_$OS.json | jq -r ".releases | map(select(.channel == \"${FLUTTER_CHANNEL}\")) | .[0].version") +if [[ $FLUTTER_VERSION == "latest" ]] then echo "Detecting latest version..." curl -L https://storage.googleapis.com/flutter_infra_release/releases/releases_$OS.json -o "${RUNNER_TEMP}/flutter_release.json" CURRENT_RELEASE=$(jq -r ".current_release.${FLUTTER_CHANNEL}" "${RUNNER_TEMP}/flutter_release.json") FLUTTER_VERSION=$(jq -r ".releases | map(select(.hash == \"${CURRENT_RELEASE}\")) | .[0].version" "${RUNNER_TEMP}/flutter_release.json") rm "${RUNNER_TEMP}/flutter_release.json" fi fi # OS archive file extension From 46e6ce1becc62a60b8136c47f0824caa2c2b3192 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 21 Oct 2023 09:15:56 +0700 Subject: [PATCH 3/4] Add "latest" to action test workflow --- .github/workflows/dart.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 06a8d1c..509b5db 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -17,7 +17,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - version: + version: + - latest - 3.3.0 - 3.0.0 - 2.10.5 @@ -47,7 +48,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - version: + version: + - latest - 3.3.0-0.0.pre - 3.1.0 steps: From 42f0d6a46c8820c79ef499fb0a5ef613b0c75891 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 21 Oct 2023 09:18:14 +0700 Subject: [PATCH 4/4] Fix latest check logic Somehow the `if` statement became a single line --- setup.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index b2f7034..fac9c7e 100755 --- a/setup.sh +++ b/setup.sh @@ -10,7 +10,13 @@ FLUTTER_CHANNEL=${2:-stable} FLUTTER_OS=$OS # Detect the latest version -if [[ $FLUTTER_VERSION == "latest" ]] then echo "Detecting latest version..." curl -L https://storage.googleapis.com/flutter_infra_release/releases/releases_$OS.json -o "${RUNNER_TEMP}/flutter_release.json" CURRENT_RELEASE=$(jq -r ".current_release.${FLUTTER_CHANNEL}" "${RUNNER_TEMP}/flutter_release.json") FLUTTER_VERSION=$(jq -r ".releases | map(select(.hash == \"${CURRENT_RELEASE}\")) | .[0].version" "${RUNNER_TEMP}/flutter_release.json") rm "${RUNNER_TEMP}/flutter_release.json" fi +if [[ $FLUTTER_VERSION == "latest" ]] +then + echo "Detecting latest version..." + curl -L https://storage.googleapis.com/flutter_infra_release/releases/releases_$OS.json -o "${RUNNER_TEMP}/flutter_release.json" + CURRENT_RELEASE=$(jq -r ".current_release.${FLUTTER_CHANNEL}" "${RUNNER_TEMP}/flutter_release.json") + FLUTTER_VERSION=$(jq -r ".releases | map(select(.hash == \"${CURRENT_RELEASE}\")) | .[0].version" "${RUNNER_TEMP}/flutter_release.json") + rm "${RUNNER_TEMP}/flutter_release.json" fi # OS archive file extension