Skip to content

Commit

Permalink
Fix build failure on macOS due to missing Homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-design committed Oct 15, 2024
1 parent e9a61fb commit 91ad2fc
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- platform: android
arch: arm64

runs-on: ${{ matrix.platform == 'macos' && matrix.arch == 'arm64' && 'macos-latest' || (matrix.platform == 'ios' && 'macos-latest' || 'ubuntu-latest') }}
runs-on: ${{ matrix.platform == 'macos' || matrix.platform == 'ios' ? 'macos-latest' : (matrix.platform == 'linux' ? 'ubuntu-latest' : 'windows-latest') }}

env:
PLATFORM: ${{ matrix.platform }}
Expand All @@ -64,7 +64,20 @@ jobs:
- name: Set up Flutter environment for macOS
if: ${{ matrix.platform == 'macos' || matrix.platform == 'ios' }}
run: |
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Set Homebrew path based on architecture
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)" # For Apple Silicon
else
eval "$(/usr/local/bin/brew shellenv)" # For Intel
fi
# Install Flutter
brew install --cask flutter
# Set PATH and check Flutter installation
export PATH="$PATH:/Users/runner/Library/Flutter/bin"
flutter doctor
Expand All @@ -75,20 +88,20 @@ jobs:
- name: Build Flutter packages
run: |
case $PLATFORM in
"linux")
linux)
flutter build linux --release --target-arch=$ARCH
;;
"windows")
windows)
flutter build windows --release --target-arch=$ARCH
;;
"macos")
macos)
flutter build macos --release
flutter build ios --release --no-codesign
;;
"android")
android)
flutter build apk --release
;;
"ios")
ios)
flutter build ios --release --no-codesign
;;
esac
Expand Down

0 comments on commit 91ad2fc

Please sign in to comment.