fvm icon indicating copy to clipboard operation
fvm copied to clipboard

[Feature Request] command to just return active version

Open josh-burton opened this issue 2 years ago • 10 comments

Before creating a feature request make sure the suggestion fit within our principles

Is your feature request related to a problem? Please describe. I'm setting up FVM with Github actions and want to cache the Flutter SDK.

I'd rather not cache the entire FVM cache directory, but just the active Flutter SDK version.

I can't seem to find an FVM command that will just return the active version, e.g. beta, dev etc.

Describe the solution you'd like A parameter added to the list command which only prints the active version:

fvm list --active prints beta

Describe alternatives you've considered

Additional context

josh-burton avatar Jul 19 '21 03:07 josh-burton

@josh-burton by the active version you mean the active version within a specific project? fvm doctor returns a lot of information about the current environment fvm is running in, maybe a flag fvm doctor --active-release might be a better option to just output the active release being used within the env.

Let me know what you think.

leoafarias avatar Jul 19 '21 11:07 leoafarias

Hi @josh-burton, I experimented a lot with FMV in Github actions but found it the easiest to just use plain Flutter there.

I created a PR in subosito/flutter-action which allows to read FVM config files easily. https://github.com/subosito/flutter-action/pull/103

Without this change I am using this:

      - name: Determine Flutter version
        uses: antifree/[email protected]
        with:
          filename: '.fvm/fvm_config.json'
          prefix: fvm
      - uses: subosito/flutter-action@v1
        with:
          flutter-version: ${{ env.fvm_flutterSdkVersion }}

kuhnroyal avatar Jul 19 '21 12:07 kuhnroyal

@kuhnroyal how does this impact the issue with the feature flags for version numbers? Does the action handles that correctly?

leoafarias avatar Jul 19 '21 12:07 leoafarias

@kuhnroyal how does this impact the issue with the feature flags for version numbers? Does the action handles that correctly?

You are right, I have not used it with such a version string. That will probably not work. I wonder if we should create a simple FVM action that reads the config file and provides the environment variables to configure the "semi-official" Flutter action.

However, this may be not what Josh needs. Didn't mean to hijack the issue :)

kuhnroyal avatar Jul 19 '21 12:07 kuhnroyal

An official action would be great!

fvm doctor --active-release would also work. I wonder if we need a command to return just the local project version, and one to return the global version as well.

Maybe fvm doctor --active-release and fvm doctor --global-release.

I currently have FVM working in actions by using the official dart action, then activating FVM via dart pub, and caching the FVM install path.

josh-burton avatar Jul 19 '21 20:07 josh-burton

@josh-burton i am not sure when I would be able to get to that but would not mind reviewing a PR to the flag and/or a fvm action.

I don't think a global version flag is needed however.

leoafarias avatar Jul 19 '21 21:07 leoafarias

I created a simple action that parses the FVM config file. It can be used together with the semi-official flutter-action as well as with custom setup.

https://github.com/kuhnroyal/flutter-fvm-config-action

kuhnroyal avatar Jul 30 '21 14:07 kuhnroyal

@kuhnroyal We have some things like that and Docker images, was thinking about linking to them on the documentation. Any suggestions?

leoafarias avatar Jul 30 '21 14:07 leoafarias

Yea maybe add some section linking to 3rd party tools and helpers.

kuhnroyal avatar Jul 30 '21 14:07 kuhnroyal

On a freshly VM/Build Node that has no previous flutter version installed via fvm, you can do this:

# install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# install fvm
brew tap leoafarias/fvm
brew install fvm

# install project's flutter version
fvm install

# set project's flutter version as global
echo 1 | fvm global

om-ha avatar Jul 06 '22 13:07 om-ha

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 02 '22 20:12 stale[bot]