flutter-action icon indicating copy to clipboard operation
flutter-action copied to clipboard

How to apply a patch in flutter directory ?

Open Ortes opened this issue 1 year ago • 1 comments

I want to apply a patch from this PR how to proceed ? On my local machine i use the following in the flutter directory:

curl https://patch-diff.githubusercontent.com/raw/flutter/flutter/pull/137874.patch > intrinsic.patch
git apply intrinsic.patch

How can I do the same from my CI ?

Ortes avatar May 28 '24 07:05 Ortes

I have a question like you, and I have a workaround, you can try it:

jobs:
  auto-build:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v4
    - uses: subosito/flutter-action@v2
      with:
        flutter-version: '3.22.2'
        channel: 'stable'
        cache: true
    - run: |
        flutter --version
        cd ${{ env.FLUTTER_ROOT }}
        curl https://patch-diff.githubusercontent.com/raw/flutter/flutter/pull/137874.patch | git apply
        git status

thaidmfinnick avatar Jul 13 '24 09:07 thaidmfinnick

hey!

@Ortes, this is an excellent question!

@thaidmfinnick, this is an excellent answer! I think it's good enough and there's no need for modifying code of the action itself.

I'm going to include this in the README so it's more easily accessible to people who might want to do the same.

bartekpacia avatar Dec 03 '24 19:12 bartekpacia

Linked to this issue from README in #337.

bartekpacia avatar Dec 03 '24 20:12 bartekpacia

If you using stable flutter you need to make patch by yourself

git checkout `stable`
git cherry-pick -n `PR`
git diff --cached > flutter.patch

Store it in your repo and try this after install

- name: Patch flutter
  run: |
    cd ${{ env.FLUTTER_ROOT }}
    git apply ~/work/your-repo/your-repo/flutter.patch
- name: Use flutter
  run: flutter run

- name: Update tools
  run: cd ${{ env.FLUTTER_ROOT }}/packages/flutter_tools && flutter pub get --no-example
- name: Use flutter with updated tools
  run: flutter-dev drive

munrocket avatar Dec 23 '24 18:12 munrocket