{"id":13530125,"url":"https://github.com/subosito/flutter-action","last_synced_at":"2025-05-13T15:10:21.289Z","repository":{"id":37644214,"uuid":"202116560","full_name":"subosito/flutter-action","owner":"subosito","description":"Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.","archived":false,"fork":false,"pushed_at":"2025-03-24T21:00:40.000Z","size":1167,"stargazers_count":2399,"open_issues_count":20,"forks_count":225,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-09T02:39:59.901Z","etag":null,"topics":["actions","dart","flutter","github-actions"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/subosito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["subosito"]}},"created_at":"2019-08-13T10:03:00.000Z","updated_at":"2025-05-07T09:42:14.000Z","dependencies_parsed_at":"2023-02-10T02:15:16.500Z","dependency_job_id":"7b3d7c84-f347-427e-b50e-393b0e5d6b1e","html_url":"https://github.com/subosito/flutter-action","commit_stats":{"total_commits":232,"total_committers":29,"mean_commits":8.0,"dds":0.4181034482758621,"last_synced_commit":"f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subosito%2Fflutter-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subosito%2Fflutter-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subosito%2Fflutter-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subosito%2Fflutter-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/subosito","download_url":"https://codeload.github.com/subosito/flutter-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253410737,"owners_count":21904129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","dart","flutter","github-actions"],"created_at":"2024-08-01T07:00:44.163Z","updated_at":"2025-05-13T15:10:16.259Z","avatar_url":"https://github.com/subosito.png","language":"Shell","readme":"# flutter-action\n\nFlutter environment for use in GitHub Actions. It works on Linux, Windows, and\nmacOS.\n\nOriginally created by [Alif Rachmawadi]. Maintained by [Bartek Pacia].\n\nThe following sections show how to configure this action.\n\n## Specifying Flutter version\n\n### Use specific version and channel\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: stable\n      flutter-version: 3.19.0\n  - run: flutter --version\n```\n\n### Use version from pubspec.yaml\n\nThis is inspired by [`actions/setup-go`](https://github.com/actions/setup-go).\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: stable\n      flutter-version-file: pubspec.yaml # path to pubspec.yaml\n  - run: flutter --version\n```\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e For `flutter-version-file` to work, you need to have the exact Flutter version\n\u003e defined in your pubspec.yaml:\n\u003e\n\u003e **Good**\n\u003e\n\u003e ```yaml\n\u003e environment:\n\u003e   sdk: \"\u003e=3.3.0 \u003c4.0.0\"\n\u003e   flutter: 3.19.0\n\u003e ```\n\u003e\n\u003e **Bad**\n\u003e\n\u003e ```yaml\n\u003e environment:\n\u003e   sdk: \"\u003e=3.3.0 \u003c4.0.0\"\n\u003e   flutter: \"\u003e= 3.19.0 \u003c4.0.0\"\n\u003e ```\n\n\u003e [!NOTE]\n\u003e\n\u003e Using `flutter-version-file` requires [`yq`](https://github.com/mikefarah/yq),\n\u003e which is not pre-installed in `windows` runners. Fortunately, since version\n\u003e 2.18.0, this action installs `yq` automatically, so no action is required from\n\u003e you.\n\n### Use latest release for particular channel\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: stable # or: beta, master (or main)\n  - run: flutter --version\n```\n\n### Use latest release for particular version and/or channel\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: dev\n      flutter-version: 1.22.x\n  - run: flutter --version\n```\n\n### Use particular version on any channel\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: any\n      flutter-version: 3.x\n  - run: flutter --version\n```\n\n### Use particular git reference on master channel\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: master\n      flutter-version: 5b12b74 # tag, commit or branch\n  - run: flutter --version\n```\n\n### Use alternative Flutter repository\n\nThis action supports \"alternative Flutters\" in addition to the official\n[`flutter/flutter`](https://github.com/flutter/flutter), for example:\n- [Flock](https://github.com/join-the-flock/flock.git)\n- [a Flutter fork that supports\n  HarmonyOS](https://gitee.com/harmonycommando_flutter/flutter.git)\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: master\n      flutter-version: 3.24.0\n      git-source: https://github.com/join-the-flock/flock.git\n  - run: flutter --version\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e This feature was implemented in\n\u003e [#344](https://github.com/subosito/flutter-action/pull/334) and is available\n\u003e since v2.18.0.\n\n### Apply a patch\n\nSometimes you find a bug in Flutter and you fix it yourself (you're a\nrockstar!), and then submit a patch/PR to Flutter repository. However, everyone\nknows that code review takes time, but your app needs the fix _now_.\n\nYou can apply your patch like this:\n\n```yaml\nsteps:\n- name: Clone repository\n  uses: actions/checkout@v4\n- uses: subosito/flutter-action@v2\n  with:\n    flutter-version: 3.22.2\n    channel: stable\n- run: |\n    flutter --version\n    cd ${{ env.FLUTTER_ROOT }}\n    curl https://patch-diff.githubusercontent.com/raw/flutter/flutter/pull/137874.patch | git apply\n    git status\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e This was first discussed in [this issue](https://github.com/subosito/flutter-action/issues/310).\n\n## Build targets\n\nBuild **Android** APK and app bundle:\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      flutter-version: 3.24.0\n  - run: flutter pub get\n  - run: flutter test\n  - run: flutter build apk\n  - run: flutter build appbundle\n```\n\n### Build for iOS\n\n\u003e [!NOTE]\n\u003e\n\u003e Building for iOS requires a macOS runner.\n\n```yaml\njobs:\n  main:\n    runs-on: macos-latest\n    steps:\n      - name: Clone repository\n        uses: actions/checkout@v4\n      - name: Set up Flutter\n        uses: subosito/flutter-action@v2\n        with:\n          channel: stable\n      - run: flutter pub get\n      - run: flutter test\n      - run: flutter build ios --release --no-codesign\n```\n\n### Build for the web\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: stable\n  - run: flutter pub get\n  - run: flutter test\n  - run: flutter build web\n```\n\n### Build for Windows\n\n```yaml\njobs:\n  main:\n    runs-on: windows-latest\n    steps:\n      - name: Clone repository\n        uses: actions/checkout@v4\n      - name: Set up Flutter\n        uses: subosito/flutter-action@v2\n        with:\n          channel: stable\n      - run: flutter build windows\n```\n\n### Build for Linux desktop\n\n```yaml\njobs:\n  main:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Clone repository\n        uses: actions/checkout@v4\n      - name: Set up Flutter\n        uses: subosito/flutter-action@v2\n        with:\n          channel: stable\n      - run: |\n          sudo apt-get update -y\n          sudo apt-get install -y ninja-build libgtk-3-dev\n      - run: flutter build linux\n```\n\n### Build for macOS desktop\n\n\u003e [!NOTE]\n\u003e\n\u003e Building for macOS requires a macOS runner.\n\n```yaml\njobs:\n  main:\n    runs-on: macos-latest\n    steps:\n      - name: Clone repository\n        uses: actions/checkout@v4\n      - name: Set up Flutter\n        uses: subosito/flutter-action@v2\n        with:\n          channel: stable\n      - run: flutter build macos\n```\n\n## Caching\n\nIntegration with [`actions/cache`](https://github.com/actions/cache):\n\n```yaml\nsteps:\n  - name: Clone repository\n    uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    with:\n      channel: stable\n      cache: true\n      # optional parameters follow\n      cache-key: \"flutter-:os:-:channel:-:version:-:arch:-:hash:\" # optional, change this to force refresh cache\n      cache-path: \"${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:\" # optional, change this to specify the cache path\n      pub-cache-key: \"flutter-pub:os:-:channel:-:version:-:arch:-:hash:\" # optional, change this to force refresh cache of dart pub get dependencies\n      pub-cache-path: \"${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:\" # optional, change this to specify the cache path\n  - run: flutter --version\n```\n\nNote: `cache-key`, `pub-cache-key`, and `cache-path` have support for several\ndynamic values:\n\n- `:os:`\n- `:channel:`\n- `:version:`\n- `:arch:`\n- `:hash:`\n- `:sha256:`\n\nUse outputs from `flutter-action`:\n\n```yaml\nsteps:\n  - name: Clone repository\n  - uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    id: flutter-action\n    with:\n      channel: stable\n  - name: Print outputs\n    shell: bash\n    run: |\n      echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}\n      echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}\n      echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}\n      echo VERSION=${{ steps.flutter-action.outputs.VERSION }}\n      echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}\n      echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}\n      echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}\n```\n\nIf you don't need to install Flutter and just want the outputs, you can use the\n`dry-run` option:\n\n```yaml\nsteps:\n  - name: Clone repository\n  - uses: actions/checkout@v4\n  - name: Set up Flutter\n    uses: subosito/flutter-action@v2\n    id: flutter-action\n    with:\n      channel: stable\n      dry-run: true\n  - run: |\n      echo CACHE-PATH=${{ steps.flutter-action.outputs.CACHE-PATH }}\n      echo CACHE-KEY=${{ steps.flutter-action.outputs.CACHE-KEY }}\n      echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}\n      echo VERSION=${{ steps.flutter-action.outputs.VERSION }}\n      echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}\n      echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}\n      echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}\n    shell: bash\n```\n[Alif Rachmawadi]: https://github.com/subosito\n[Bartek Pacia]: https://github.com/bartekpacia\n","funding_links":["https://github.com/sponsors/subosito"],"categories":["Shell","Community Resources","六、编程语言与工具专属Action"],"sub_categories":["Collection of Actions","8. 环境配置"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubosito%2Fflutter-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubosito%2Fflutter-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubosito%2Fflutter-action/lists"}