skip to Main Content

Xcode cloud how to use specific flutter version like 3.19.6 instead of latest?

2

Answers


  1. Chosen as BEST ANSWER

    Replace these lines:

    git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter
    export PATH="$PATH:$HOME/flutter/bin"
    
    # Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
    flutter precache --ios
    
    # Install Flutter dependencies.
    flutter pub get
    

    with:

    # Install Flutter using fvm.
    brew tap leoafarias/fvm
    brew install fvm
    fvm install 3.19.6
    fvm global 3.19.6
    
    # Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
    fvm flutter precache --ios
    
    # Install Flutter dependencies.
    fvm flutter pub get
    

    Complete file ci_post_clone.sh file:

    #!/bin/sh
    
    # The default execution directory of this script is the ci_scripts directory.
    cd $CI_PRIMARY_REPOSITORY_PATH # change working directory to the root of your cloned repo.
    
    # Install Flutter using fvm.
    brew tap leoafarias/fvm
    brew install fvm
    fvm install 3.19.6
    fvm global 3.19.6
    
    # Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
    fvm flutter precache --ios
    
    # Install Flutter dependencies.
    fvm flutter pub get
    
    # Install CocoaPods using Homebrew.
    HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates.
    brew install cocoapods
    
    export GEM_HOME="$HOME/.gem"
    gem install cocoapods
    # Install CocoaPods dependencies.
    cd ios && rm -rf Pods && gem install cocoapods && pod install
    sudo arch -x86_64 gem install ffi
    arch -x86_64 pod install
    
    exit 0
    

  2. replace this line

    # Install Flutter using git.
    git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter
    export PATH="$PATH:$HOME/flutter/bin"
    

    with this

    # Install Flutter using git.
    git clone https://github.com/flutter/flutter.git --depth 1 -b VERSION_NO $HOME/flutter
    export PATH="$PATH:$HOME/flutter/bin"
    

    SO IF THE VERSION you want to use is 3.10.5

    it will become
    # Install Flutter using git.
    git clone https://github.com/flutter/flutter.git –depth 1 -b 3.10.5 $HOME/flutter
    export PATH="$PATH:$HOME/flutter/bin"

    full code becomes this

    #!/bin/sh
    
    # Fail this script if any subcommand fails.
    set -e
    
    # The default execution directory of this script is the ci_scripts directory.
    cd $CI_PRIMARY_REPOSITORY_PATH # change working directory to the root of your cloned repo.
    
    # Install Flutter using git.
    git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter
    export PATH="$PATH:$HOME/flutter/bin"
    
    # Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
    flutter precache --ios
    
    # Install Flutter dependencies.
    flutter pub get
    
    # Install CocoaPods using Homebrew.
    HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates.
    brew install cocoapods
    
    # Install CocoaPods dependencies.
    cd ios && pod install # run `pod install` in the `ios` directory.
    
    exit 0
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search