subosito / flutter-action

Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.
MIT License
2.23k stars 199 forks source link

Add support for reading Flutter version from config files #103

Closed kuhnroyal closed 3 years ago

kuhnroyal commented 3 years ago
subosito commented 3 years ago

Thanks for the PR @kuhnroyal, I appreciate it.

I was thinking similar solution in https://github.com/subosito/flutter-action/issues/47#issuecomment-830146625. But that's become an issue when we need to support various configs other than pubspec.yaml and when needed additional parameters.

For this case, I prefer having separate action to do the parsing and pass it to flutter-action. So we can focus on the strength of each action.

I propose something like:

- uses: subosito/flutter-version@v1
  id: flutter-version
  with:
    adapter: 'pubspec'
    path: 'path/to/custom/pubspec.yaml' # optional, default to pubspec.yaml
- uses: subosito/flutter-action@v1
  with:
    flutter-version: "{{ steps.flutter-version.outputs.VERSION }}"

What do you think?

kuhnroyal commented 3 years ago

I don't know, You can pretty much do it the same way with any of the JSON/Yaml-path actions. It is not much of an improvement then tbh.

kuhnroyal commented 3 years ago

But yea the path needs to be configurable. Didn't think about that.

kuhnroyal commented 3 years ago

Maybe set the version into the environment and the read it from there.

- uses: subosito/flutter-version@v1
  with:
    adapter: 'pubspec'
    path: 'path/to/custom/pubspec.yaml' # optional, default to pubspec.yaml
- uses: subosito/flutter-action@v1

This would also allow simply usage like:

env:
  FLUTTER_VERSION: 2.0.6

...
- uses: subosito/flutter-action@v1
benPesso commented 3 years ago

Maybe set the version into the environment and the read it from there.

- uses: subosito/flutter-version@v1
  with:
    adapter: 'pubspec'
    path: 'path/to/custom/pubspec.yaml' # optional, default to pubspec.yaml
- uses: subosito/flutter-action@v1

This would also allow simply usage like:

env:
  FLUTTER_VERSION: 2.0.6

...
- uses: subosito/flutter-action@v1

This will just move the original issue from the action to the shared secrets - the fact that the version number still needs to be maintained in more than one place.

kuhnroyal commented 3 years ago

This will just move the original issue from the action to the shared secrets - the fact that the version number still needs to be maintained in more than one place.

Not in the first case. The 2nd case is just something that would also work if needed when setting/reading it from the environment.

kuhnroyal commented 3 years ago

@subosito How do you want to proceed with this?

kuhnroyal commented 3 years ago

Added a custom action for FVM - see #101 Other setup actions can follow the same path I suppose.