2024-03-31 19:15:36 +02:00
|
|
|
name: Set up Flutter
|
|
|
|
|
description: Setup your runner with Flutter environment
|
|
|
|
|
author: Alif Rachmawadi
|
2022-01-06 07:40:25 +00:00
|
|
|
branding:
|
2024-03-31 19:15:36 +02:00
|
|
|
icon: maximize
|
|
|
|
|
color: blue
|
2024-03-31 22:15:17 +02:00
|
|
|
|
2019-08-13 17:11:30 +07:00
|
|
|
inputs:
|
|
|
|
|
channel:
|
2024-03-31 19:15:36 +02:00
|
|
|
description: The Flutter build release channel
|
2019-08-13 17:11:30 +07:00
|
|
|
required: false
|
2024-03-31 19:15:36 +02:00
|
|
|
default: stable
|
2024-04-01 04:03:05 +02:00
|
|
|
flutter-version:
|
|
|
|
|
description: The Flutter version to make available on the path
|
|
|
|
|
required: false
|
|
|
|
|
default: ""
|
|
|
|
|
flutter-version-file:
|
2026-03-18 13:18:09 +00:00
|
|
|
description: The pubspec.yaml or FVM config file with exact Flutter version defined
|
2024-04-01 04:03:05 +02:00
|
|
|
required: false
|
|
|
|
|
default: ""
|
|
|
|
|
architecture:
|
|
|
|
|
description: The architecture of Flutter SDK executable (x64 or arm64)
|
|
|
|
|
required: false
|
|
|
|
|
default: "${{ runner.arch }}"
|
2022-01-08 14:55:41 +00:00
|
|
|
cache:
|
2024-03-31 19:15:36 +02:00
|
|
|
description: Cache the Flutter SDK
|
2022-01-08 14:55:41 +00:00
|
|
|
required: false
|
2024-03-31 19:15:36 +02:00
|
|
|
default: "false"
|
2022-01-08 14:55:41 +00:00
|
|
|
cache-key:
|
2024-03-31 19:15:36 +02:00
|
|
|
description: Identifier for the Flutter SDK cache
|
2022-01-08 14:55:41 +00:00
|
|
|
required: false
|
2024-04-01 04:03:05 +02:00
|
|
|
default: ""
|
2022-01-13 10:10:55 +00:00
|
|
|
cache-path:
|
2024-03-31 19:15:36 +02:00
|
|
|
description: Flutter SDK cache path
|
2022-01-13 10:10:55 +00:00
|
|
|
required: false
|
2024-04-01 04:03:05 +02:00
|
|
|
default: ""
|
2026-03-18 15:31:10 +01:00
|
|
|
pub-cache:
|
|
|
|
|
description: Cache the Dart pub dependencies
|
|
|
|
|
required: false
|
|
|
|
|
default: ""
|
2024-04-01 04:03:05 +02:00
|
|
|
pub-cache-key:
|
|
|
|
|
description: Identifier for the Dart .pub-cache cache
|
|
|
|
|
required: false
|
|
|
|
|
default: ""
|
2024-03-20 12:20:53 +08:00
|
|
|
pub-cache-path:
|
2024-03-31 19:15:36 +02:00
|
|
|
description: Flutter pub cache path
|
2024-03-20 12:20:53 +08:00
|
|
|
required: false
|
2024-03-31 19:15:36 +02:00
|
|
|
default: default
|
2024-04-02 21:25:52 +09:00
|
|
|
dry-run:
|
|
|
|
|
description: If true, get outputs but do not install Flutter
|
|
|
|
|
required: false
|
|
|
|
|
default: "false"
|
2024-12-04 03:23:57 +08:00
|
|
|
git-source:
|
|
|
|
|
description: Git clone source
|
|
|
|
|
required: false
|
|
|
|
|
default: "https://github.com/flutter/flutter.git"
|
2024-03-31 22:15:17 +02:00
|
|
|
|
2022-09-08 08:41:22 +07:00
|
|
|
outputs:
|
2022-10-13 06:31:27 +07:00
|
|
|
CHANNEL:
|
2024-03-31 19:15:36 +02:00
|
|
|
value: "${{ steps.flutter-action.outputs.CHANNEL }}"
|
2024-03-31 19:21:19 +02:00
|
|
|
description: The selected Flutter release channel
|
2022-10-13 06:31:27 +07:00
|
|
|
VERSION:
|
2024-03-31 19:15:36 +02:00
|
|
|
value: "${{ steps.flutter-action.outputs.VERSION }}"
|
2024-03-31 19:21:19 +02:00
|
|
|
description: The selected Flutter version
|
2022-10-13 06:31:27 +07:00
|
|
|
ARCHITECTURE:
|
2024-03-31 19:15:36 +02:00
|
|
|
value: "${{ steps.flutter-action.outputs.ARCHITECTURE }}"
|
2024-03-31 19:21:19 +02:00
|
|
|
description: The selected Flutter CPU architecture
|
2024-04-01 04:03:05 +02:00
|
|
|
CACHE-KEY:
|
|
|
|
|
value: "${{ steps.flutter-action.outputs.CACHE-KEY }}"
|
|
|
|
|
description: Key used to cache the Flutter SDK
|
|
|
|
|
CACHE-PATH:
|
|
|
|
|
value: "${{ steps.flutter-action.outputs.CACHE-PATH }}"
|
|
|
|
|
description: Path to Flutter SDK
|
2024-02-12 16:13:38 -08:00
|
|
|
PUB-CACHE-KEY:
|
2024-03-31 19:15:36 +02:00
|
|
|
value: "${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}"
|
2024-03-31 19:21:19 +02:00
|
|
|
description: Key used to cache the pub dependencies
|
2024-02-12 16:13:38 -08:00
|
|
|
PUB-CACHE-PATH:
|
2024-03-31 19:15:36 +02:00
|
|
|
value: "${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}"
|
2024-03-31 19:21:19 +02:00
|
|
|
description: Path to pub cache
|
2024-12-04 03:23:57 +08:00
|
|
|
GIT_SOURCE:
|
|
|
|
|
value: "${{ steps.flutter-action.outputs.GIT_SOURCE }}"
|
|
|
|
|
description: Git source of Flutter SDK repository to clone
|
2025-06-24 14:41:32 -07:00
|
|
|
CACHE-HIT:
|
|
|
|
|
value: "${{ steps.cache-flutter.outputs.cache-hit }}"
|
|
|
|
|
description: "`true` if the flutter cache was a hit"
|
|
|
|
|
PUB-CACHE-HIT:
|
|
|
|
|
value: "${{ steps.cache-pub.outputs.cache-hit }}"
|
|
|
|
|
description: "`true` if the pub cache was a hit"
|
2024-03-31 22:15:17 +02:00
|
|
|
|
2019-08-13 17:11:30 +07:00
|
|
|
runs:
|
2024-03-31 19:15:36 +02:00
|
|
|
using: composite
|
2022-01-06 07:40:25 +00:00
|
|
|
steps:
|
2025-06-09 09:54:01 +02:00
|
|
|
# This is a cross-platform composite action that needs yq in order to parse
|
|
|
|
|
# the pubspec.yaml file.
|
2024-12-03 20:05:47 +01:00
|
|
|
# It's not preinstalled on Windows runners.
|
|
|
|
|
# See https://github.com/actions/runner-images/issues/7443#issuecomment-1514597691
|
|
|
|
|
- name: Make yq tool available on Windows runners
|
2026-03-18 13:18:09 +00:00
|
|
|
if: runner.os == 'Windows' && inputs.flutter-version-file != '' && !endsWith(inputs.flutter-version-file, '.fvmrc') && !endsWith(inputs.flutter-version-file, 'fvm_config.json')
|
2024-12-03 20:05:47 +01:00
|
|
|
run: choco install yq
|
|
|
|
|
shell: bash
|
|
|
|
|
|
2024-03-31 19:21:19 +02:00
|
|
|
- name: Make setup script executable
|
|
|
|
|
run: chmod +x "$GITHUB_ACTION_PATH/setup.sh"
|
2023-11-01 17:59:30 +07:00
|
|
|
shell: bash
|
2024-03-31 22:15:17 +02:00
|
|
|
|
|
|
|
|
- name: Set action inputs
|
2024-03-31 19:21:19 +02:00
|
|
|
id: flutter-action
|
2022-07-24 19:19:31 +07:00
|
|
|
shell: bash
|
2024-03-31 22:15:17 +02:00
|
|
|
run: |
|
|
|
|
|
$GITHUB_ACTION_PATH/setup.sh -p \
|
|
|
|
|
-n '${{ inputs.flutter-version }}' \
|
2024-04-01 04:03:05 +02:00
|
|
|
-f '${{ inputs.flutter-version-file }}' \
|
2024-03-31 22:15:17 +02:00
|
|
|
-a '${{ inputs.architecture }}' \
|
2024-04-01 04:03:05 +02:00
|
|
|
-k '${{ inputs.cache-key }}' \
|
|
|
|
|
-c '${{ inputs.cache-path }}' \
|
|
|
|
|
-l '${{ inputs.pub-cache-key }}' \
|
|
|
|
|
-d '${{ inputs.pub-cache-path }}' \
|
2024-12-04 03:23:57 +08:00
|
|
|
-g '${{ inputs.git-source }}' \
|
2024-03-31 22:15:17 +02:00
|
|
|
${{ inputs.channel }}
|
|
|
|
|
|
2024-03-31 19:21:19 +02:00
|
|
|
- name: Cache Flutter
|
2025-06-24 14:41:32 -07:00
|
|
|
id: cache-flutter
|
2026-03-16 16:24:34 +08:00
|
|
|
uses: actions/cache@v5
|
2024-03-31 22:15:17 +02:00
|
|
|
if: ${{ inputs.cache == 'true' }}
|
2022-01-08 14:55:41 +00:00
|
|
|
with:
|
2022-10-13 06:31:27 +07:00
|
|
|
path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
|
2024-02-12 16:13:38 -08:00
|
|
|
key: ${{ steps.flutter-action.outputs.CACHE-KEY }}
|
2024-03-31 22:15:17 +02:00
|
|
|
|
2024-03-31 19:21:19 +02:00
|
|
|
- name: Cache pub dependencies
|
2026-03-16 16:24:34 +08:00
|
|
|
uses: actions/cache@v5
|
2025-06-24 14:41:32 -07:00
|
|
|
id: cache-pub
|
2026-03-18 15:31:10 +01:00
|
|
|
if: ${{ (inputs.pub-cache == '' && inputs.cache == 'true') || inputs.pub-cache == 'true' }}
|
2024-02-12 16:13:38 -08:00
|
|
|
with:
|
|
|
|
|
path: ${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
|
|
|
|
key: ${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }}
|
2024-03-31 22:15:17 +02:00
|
|
|
|
|
|
|
|
- name: Run setup script
|
2022-01-06 07:40:25 +00:00
|
|
|
shell: bash
|
2024-08-21 02:53:58 +01:00
|
|
|
if: ${{ inputs.dry-run != 'true' && inputs.dry-run != true }}
|
2024-03-31 22:15:17 +02:00
|
|
|
run: |
|
|
|
|
|
$GITHUB_ACTION_PATH/setup.sh \
|
|
|
|
|
-n '${{ steps.flutter-action.outputs.VERSION }}' \
|
|
|
|
|
-a '${{ steps.flutter-action.outputs.ARCHITECTURE }}' \
|
2024-04-01 04:03:05 +02:00
|
|
|
-c '${{ steps.flutter-action.outputs.CACHE-PATH }}' \
|
2025-03-24 21:46:39 +01:00
|
|
|
-d '${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}' \
|
2024-03-31 22:15:17 +02:00
|
|
|
${{ steps.flutter-action.outputs.CHANNEL }}
|