From 1be58cb27f7fb0fdffbe9d2d9cfce30b09e38780 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 01:19:03 +0700 Subject: [PATCH 1/9] Fix macos build failed to download artifact --- setup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index fac9c7e..90815e1 100755 --- a/setup.sh +++ b/setup.sh @@ -27,9 +27,10 @@ then fi # Apple Intel or Apple Silicon -if [[ $OS == macos && $ARCH == 'arm64' && $FLUTTER_VERSION == 3.* ]] +if [[ $OS == "macos" && $ARCH == "arm64" && $FLUTTER_VERSION < 3.* ]] then - FLUTTER_OS="${FLUTTER_OS}_$ARCH" + echo -e "::error::Flutter SDK version \"${FLUTTER_VERSION}\" is not supported on Apple Silicon. Please use version 3.0.0 or higher." + exit 1 fi # Flutter runner tool cache From 983dd2bb574a92b27325e4c8ad83b7745c5ec787 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 01:23:03 +0700 Subject: [PATCH 2/9] modified: .github/workflows/dart.yml --- .github/workflows/dart.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 509b5db..d289a5c 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -21,7 +21,6 @@ jobs: - latest - 3.3.0 - 3.0.0 - - 2.10.5 steps: - uses: actions/checkout@v3 From a06f1282f55505c10a9d93b3b96c33162addc1f6 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 13:31:06 +0700 Subject: [PATCH 3/9] Set default FLUTTER_VERSION to latest --- action.yml | 4 ++-- setup.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index fb3d9a6..8c0f0b1 100644 --- a/action.yml +++ b/action.yml @@ -5,9 +5,9 @@ branding: color: "blue" inputs: version: - description: "The version to install: Default: 3.0.2" + description: "The version to install: Default: latest" required: false - default: "3.0.2" + default: "latest" channel: description: "The version to install. Default: stable" required: false diff --git a/setup.sh b/setup.sh index 90815e1..534e8e9 100755 --- a/setup.sh +++ b/setup.sh @@ -5,8 +5,8 @@ ARCH=$(echo "${RUNNER_ARCH:-x64}" | awk '{print tolower($0)}') OS=$(echo "${RUNNER_OS:-linux}" | awk '{print tolower($0)}') # Args -FLUTTER_VERSION=${1:-3.0.2} -FLUTTER_CHANNEL=${2:-stable} +FLUTTER_VERSION=${1:-"latest"} +FLUTTER_CHANNEL=${2:-"stable"} FLUTTER_OS=$OS # Detect the latest version From d328a81db77bb1741a7d06397e17934651ad5ed7 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 13:49:28 +0700 Subject: [PATCH 4/9] Fix macos_arm64 download url --- setup.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/setup.sh b/setup.sh index 534e8e9..5b5ea8d 100755 --- a/setup.sh +++ b/setup.sh @@ -19,13 +19,6 @@ then rm "${RUNNER_TEMP}/flutter_release.json" fi -# OS archive file extension -EXT="zip" -if [[ $OS == linux ]] -then - EXT="tar.xz" -fi - # Apple Intel or Apple Silicon if [[ $OS == "macos" && $ARCH == "arm64" && $FLUTTER_VERSION < 3.* ]] then @@ -43,8 +36,15 @@ FLUTTER_RUNNER_TOOL_CACHE="${RUNNER_TOOL_CACHE}/flutter-${RUNNER_OS}-${FLUTTER_V # https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_3.0.2-stable.zip FLUTTER_RELEASE_URL="https://storage.googleapis.com/flutter_infra_release/releases" +# OS archive file extension +EXT="zip" +if [[ $OS == "linux" ]] +then + EXT="tar.xz" +fi if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then + FLUTTER_BUILD_OS=$FLUTTER_OS echo "Installing Flutter SDK version \"${FLUTTER_VERSION}\" from the ${FLUTTER_CHANNEL} channel on ${FLUTTER_OS}" # Linux @@ -60,7 +60,14 @@ if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then # Windows # /stable /windows/ flutter_windows_3.0.2-stable.zip # /beta /windows/ flutter_windows_3.1.0-9.0.pre-beta.zip - FLUTTER_BUILD="flutter_${FLUTTER_OS}_${FLUTTER_VERSION}-${FLUTTER_CHANNEL}.${EXT}" + + # Apple Intel or Apple Silicon + if [[ $OS == "macos" && $ARCH == "arm64" ]] + then + FLUTTER_BUILD_OS="macos_arm64" + fi + + FLUTTER_BUILD="flutter_${FLUTTER_BUILD_OS}_${FLUTTER_VERSION}-${FLUTTER_CHANNEL}.${EXT}" FLUTTER_DOWNLOAD_URL="${FLUTTER_RELEASE_URL}/${FLUTTER_CHANNEL}/${FLUTTER_OS}/${FLUTTER_BUILD}" echo "Downloading ${FLUTTER_DOWNLOAD_URL}" From 715b25beb9a198a7ca2995f945d607b61392a19f Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 14:03:38 +0700 Subject: [PATCH 5/9] Update workflow to include both macos-latest (Apple M1 Silicon) and macos-13 (Intel Mac) --- .github/workflows/dart.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index d289a5c..3f0b312 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -16,7 +16,11 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: + - ubuntu-latest + - macos-latest # Apple M1 Silicon + - macos-13 # Intel Mac + - windows-latest version: - latest - 3.3.0 @@ -46,7 +50,11 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: + - ubuntu-latest + - macos-latest # Apple M1 Silicon + - macos-13 # Intel Mac + - windows-latest version: - latest - 3.3.0-0.0.pre From 1211029baa583a1dca4281ac1ab886b5e924f343 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Thu, 18 Apr 2024 17:05:05 +0700 Subject: [PATCH 6/9] renamed: setup.sh -> action.sh --- setup.sh => action.sh | 0 action.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename setup.sh => action.sh (100%) diff --git a/setup.sh b/action.sh similarity index 100% rename from setup.sh rename to action.sh diff --git a/action.yml b/action.yml index 8c0f0b1..fc2a6ee 100644 --- a/action.yml +++ b/action.yml @@ -28,5 +28,5 @@ runs: with: path: ${{ runner.tool_cache }}/flutter-${{ runner.os }}-${{ inputs.version }}-${{ runner.arch }} key: flutter-action-setup-flutter-${{ runner.os }}-${{ inputs.version }}-${{ inputs.channel }}-${{ runner.arch }}-${{ inputs.cache-key }} - - run: $GITHUB_ACTION_PATH/setup.sh ${{ inputs.version }} ${{ inputs.channel }} + - run: $GITHUB_ACTION_PATH/action.sh ${{ inputs.version }} ${{ inputs.channel }} shell: bash From 6f0a8c84a0d9b93689b51c5e3df7adce08a6f538 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 16:08:06 +0700 Subject: [PATCH 7/9] Rework latest version detection # Conflicts: # action.sh --- action.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/action.sh b/action.sh index 5b5ea8d..16bbf0e 100755 --- a/action.sh +++ b/action.sh @@ -12,11 +12,18 @@ 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" + FLUTTER_RELEASE_MANIFEST_URL="https://storage.googleapis.com/flutter_infra_release/releases/releases_$OS.json" + FLUTTER_RELEASE_MANIFEST_FILE="${RUNNER_TEMP}/flutter_release.json" + echo "Detecting latest version..." + if curl -fsSL "$FLUTTER_RELEASE_MANIFEST_URL" -o "$FLUTTER_RELEASE_MANIFEST_FILE"; + then + CURRENT_RELEASE=$(jq -r ".current_release.${FLUTTER_CHANNEL}" "$FLUTTER_RELEASE_MANIFEST_FILE") + FLUTTER_VERSION=$(jq -r ".releases | map(select(.hash == \"${CURRENT_RELEASE}\")) | .[0].version" "$FLUTTER_RELEASE_MANIFEST_FILE") + rm "$FLUTTER_RELEASE_MANIFEST_FILE" + else + echo -e "::error::Failed to detect the latest version." + exit 1 + fi fi # Apple Intel or Apple Silicon From 2ac4c578d28543ddfec114151f3615f4d6cab305 Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 16:23:01 +0700 Subject: [PATCH 8/9] Tweak log output --- action.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.sh b/action.sh index 16bbf0e..3fda148 100755 --- a/action.sh +++ b/action.sh @@ -52,7 +52,7 @@ fi if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then FLUTTER_BUILD_OS=$FLUTTER_OS - echo "Installing Flutter SDK version \"${FLUTTER_VERSION}\" from the ${FLUTTER_CHANNEL} channel on ${FLUTTER_OS}" + echo "Installing Flutter SDK version \"${FLUTTER_VERSION}\" from the ${FLUTTER_CHANNEL} channel for ${OS}/${ARCH}..." # Linux # /stable /linux/ flutter_linux_2.10.2-stable.tar.xz @@ -99,7 +99,7 @@ if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then exit 1 fi else - echo "Cache restored Flutter SDK version \"${FLUTTER_VERSION}\" from the ${FLUTTER_CHANNEL} channel on ${FLUTTER_OS}" + echo "Cache restored Flutter SDK version \"${FLUTTER_VERSION}\" from the ${FLUTTER_CHANNEL} channel for ${OS}/${ARCH}." fi # Configure pub to use a fixed location. From 85f2ad8491e324611660efe25cb8de027c1d6dbb Mon Sep 17 00:00:00 2001 From: Socheat Sok Date: Sat, 27 Apr 2024 16:26:01 +0700 Subject: [PATCH 9/9] Tweak log output --- action.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.sh b/action.sh index 3fda148..7910843 100755 --- a/action.sh +++ b/action.sh @@ -52,7 +52,7 @@ fi if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then FLUTTER_BUILD_OS=$FLUTTER_OS - echo "Installing Flutter SDK version \"${FLUTTER_VERSION}\" from the ${FLUTTER_CHANNEL} channel for ${OS}/${ARCH}..." + echo "Installing Flutter SDK version: ${FLUTTER_VERSION} (${FLUTTER_CHANNEL}) on \"${OS}_${ARCH}\" ..." # Linux # /stable /linux/ flutter_linux_2.10.2-stable.tar.xz @@ -99,7 +99,7 @@ if [ ! -d "${FLUTTER_RUNNER_TOOL_CACHE}" ]; then exit 1 fi else - echo "Cache restored Flutter SDK version \"${FLUTTER_VERSION}\" from the ${FLUTTER_CHANNEL} channel for ${OS}/${ARCH}." + echo "Cache restored Flutter SDK version: ${FLUTTER_VERSION} (${FLUTTER_CHANNEL}) on \"${OS}_${ARCH}\"" fi # Configure pub to use a fixed location.