Closed bartekpacia closed 8 months ago
Until this feature is added, it can be achieved with GITHUB_ENV
, e.g., if the pubspec.yaml
contains
flutter: ">=3.13.7"
The version can be extracted with:
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v3
- name: Set Flutter version
run: |
export FLUTTER_VERSION="$(sed -E -n -e 's/^.*flutter:\ ">=([0-9.]+)"/\1/p' pubspec.yaml)"
echo "FLUTTER_VERSION=$FLUTTER_VERSION" >> $GITHUB_ENV
- name: ⚙️ Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "${{ env.FLUTTER_VERSION }}"
channel: 'stable'
cache: true
id: flutter
For an example you can check my gh-action.yml
Until we have a standard definition in pubspec.yaml
for flutter version, please use the yq
and/or shell script, as @braniii mentioned.
The
actions/setup-go
action provides a way to use the version from thego.mod
file (equivalent ofpubspec.yaml
):I'd like this action to be able to do the same:
pubspec.yaml
also allows version constraints (see discussion #215). To avoid complexity it brings, usingflutter-version-file
would require the Flutter version constraint to be a single version, for example:The version can be easily retrieved using yq: