subosito / flutter-action

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

Remove yq dependency to fetch version from file #306

Open danielgomezrico opened 1 month ago

danielgomezrico commented 1 month ago

Hi

Theres a bash way to parse the file and is using grep and awk like: I use that on my scripts like:


      - name: Prepare flutter version from pubspec.yml
        run: |
          $content = Get-Content -Path pubspec.yaml
          $match = [regex]::match($content, 'flutter: (\d+\.\d+\.\d+)')
          echo "FLUTTER_VERSION=$($match.Groups[1].Value)" | Out-File -FilePath $env:GITHUB_ENV -Append
        shell: pwsh

      - uses: subosito/flutter-action@v2
        with:
          flutter-version: ${{env.FLUTTER_VERSION}}
          cache: false

Maybe the way that flutter-version-file works could change to this to avoid the YQ dependency install on windows, WDYT? can you guide me on how to change that? I could create the PR with that change 🤓

yurikoles commented 1 month ago
  1. Clone the repository.
  2. Read the source code.
  3. Change it.
  4. Test it. ...
  5. Fix is released.
  6. PROFIT!
alleey commented 1 month ago

Why is there a downvote on this? It a legit request. Its a great plugin but fails on Windows due to the yq dependency.

This is my usage example https://github.com/alleey/flutter-guesstheword/actions/runs/9027817973/workflow

and reading version from pubspec works except for Windows. I had to figure it out the hard way after so many failed attempts. The solution, for now, is to hard code version for the Windows platform.

It would be really great if Windows' builds could read version from pubspec.

kuhnroyal commented 1 month ago

See https://github.com/actions/runner-images/issues/7443 - hopefully this will be reconsidered.