Skip to content
@flutter-actions

GitHub Actions for Flutter SDK

A collection of community GitHub Actions for Flutter SDK

About

This GitHub Action installs and sets up of a Flutter SDK for use in actions by:

  • Downloading the Flutter SDK
  • Adding the flutter command and dart command to path
  • Support for caching the Flutter SDK and pub dependencies
  • Support for automated publishing of packages to Pub.dev

Flutter SDK for Windows Flutter SDK for Linux Flutter SDK for macOS Flutter SDK for macOS (Intel)

Inputs

The action takes the following inputs:

  • version: (Required) A specific Flutter SDK version to install, e.g. latest or 3.0.2 or 3.1.0-9.0.pre

  • channel: (Required) The Flutter SDK release channel to install. Available channels are stable, beta. See https://flutter.dev/docs/development/tools/sdk/releases for details.

  • cache: (Optional) Enable cache of the pub dependencies. Default: false

  • cache-sdk: (Optional) Enable cache of the installed Flutter SDK. Default: false

  • cache-key: (Optional) An explicit key for restoring and saving the pub dependencies to/from cache

Basic example

Install the latest stable SDK, and run Hello World.

name: Flutter

on:
  push:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Setup Flutter SDK
        uses: flutter-actions/setup-flutter@v4
        with:
          channel: stable
          version: 3.0.2

      - name: Install dependencies
        run: flutter pub get

      - name: Analyze project source
        run: dart analyze

      - name: Run tests
        run: flutter test

Automated publishing of packages to Pub.dev

You can automated publishing of packages to Pub.dev from GitHub Actions by using the flutter-actions/setup-pubdev-credentials action.

# Setup Flutter SDK and automated pub.dev credentials
- uses: flutter-actions/setup-flutter@v3
- uses: flutter-actions/setup-pubdev-credentials@v1

Automated job matrix across multiple version of Flutter SDK

You can automated job matrix across multiple version of Flutter SDK by using flutter-actions/pubspec-matrix-action action. This GitHub Action generates a matrix of Dart and Flutter SDK versions from a pubspec.yaml file.

Troubleshooting

Apple Silicon

If you are running this on self-hosted runner specially with Apple Silicon Mac only Flutter SDK v3.0.0 or later are supported.

For more information plase check https://docs.flutter.dev/get-started/install/macos.

Flutter uses Google Analytics

Starting from flutter-actions/setup-flutter@v3, the action will disable Flutter SDK built-in Google Analytics by default.

Using outside of GitHub Actions environment

This action is designed to be used in GitHub Actions environment. If you want to use it outside of GitHub Actions, you can use the following script:

# Usage:
#     curl -fsSL https://raw.githubusercontent.com/flutter-actions/setup-flutter/main/install.sh | bash -s -- <version> <channel>
# 
# Example:

export SETUP_FLUTTER_BRANCH=main
curl -fsSL https://raw.githubusercontent.com/flutter-actions/setup-flutter/${SETUP_FLUTTER_BRANCH}/install.sh | bash -s -- 3.0.2 stable

Alternatives

The GitHub Actions for Flutter SDK team also implemented an alternative action to Setup Flutter SDK using Flutter Version Management fvm. See flutter-actions/setup-fvm for more information.

See also:

License

Licensed under the MIT License.

Pinned Loading

  1. setup-flutter setup-flutter Public

    This GitHub Action installs and setup of a Flutter SDK

    Shell 22 11

  2. setup-fvm setup-fvm Public

    Setup Flutter Version Management: A simple CLI to manage Flutter SDK versions.

    Shell 1

  3. setup-pubdev-credentials setup-pubdev-credentials Public

    GitHub Action to configuring credentials for automated publishing of packages to pub.dev

    Shell 1 1

  4. pubspec-matrix-action pubspec-matrix-action Public

    This GitHub Action generates a matrix of Dart and Flutter SDK versions from a pubspec.yaml file.

    JavaScript

Repositories

Showing 5 of 5 repositories
  • setup-pubdev-credentials Public

    GitHub Action to configuring credentials for automated publishing of packages to pub.dev

    flutter-actions/setup-pubdev-credentials’s past year of commit activity
    Shell 1 MIT 1 0 0 Updated Dec 16, 2024
  • .github Public

    The `flutter-actions` organization's profile

    flutter-actions/.github’s past year of commit activity
    0 0 0 0 Updated Dec 13, 2024
  • setup-flutter Public

    This GitHub Action installs and setup of a Flutter SDK

    flutter-actions/setup-flutter’s past year of commit activity
    Shell 22 MIT 11 0 0 Updated Dec 13, 2024
  • setup-fvm Public

    Setup Flutter Version Management: A simple CLI to manage Flutter SDK versions.

    flutter-actions/setup-fvm’s past year of commit activity
    Shell 1 MIT 0 2 0 Updated Oct 23, 2024
  • pubspec-matrix-action Public

    This GitHub Action generates a matrix of Dart and Flutter SDK versions from a pubspec.yaml file.

    flutter-actions/pubspec-matrix-action’s past year of commit activity
    JavaScript 0 MIT 0 0 4 Updated Sep 4, 2024

Top languages

Loading…

Most used topics

Loading…