Skip to content

Commit 38d1dd2

Browse files
committed
Add separate setup action
1 parent 4155f8c commit 38d1dd2

File tree

5 files changed

+146
-33
lines changed

5 files changed

+146
-33
lines changed

.github/workflows/test.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,35 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13+
test-config-old:
14+
name: Config only (old)
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
- name: Setup Flutter
20+
id: config
21+
uses: ./
22+
with:
23+
path: test/.fvmrc
24+
- run: echo ${{ steps.config.outputs.FLUTTER_VERSION }}
25+
- run: echo ${{ steps.config.outputs.FLUTTER_CHANNEL }}
26+
- run: echo ${{ env.FLUTTER_VERSION }}
27+
- run: echo ${{ env.FLUTTER_CHANNEL }}
28+
29+
test-setup-flutter-old:
30+
name: Setup Flutter (old)
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
- name: Setup Flutter
36+
uses: ./
37+
with:
38+
path: test/.fvmrc
39+
setup: true
40+
- run: flutter --version
41+
1342
test-config:
1443
name: Config only
1544
runs-on: ubuntu-latest
@@ -18,7 +47,7 @@ jobs:
1847
uses: actions/checkout@v4
1948
- name: Setup Flutter
2049
id: config
21-
uses: ./
50+
uses: ./config
2251
with:
2352
path: test/.fvmrc
2453
- run: echo ${{ steps.config.outputs.FLUTTER_VERSION }}
@@ -33,8 +62,8 @@ jobs:
3362
- name: Checkout repository
3463
uses: actions/checkout@v4
3564
- name: Setup Flutter
36-
uses: ./
65+
uses: ./setup
3766
with:
3867
path: test/.fvmrc
39-
setup: true
4068
- run: flutter --version
69+

README.md

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,80 @@
11
# flutter-fvm-config-action
2-
An action that parses an [FVM](https://github.com/leoafarias/fvm) config file (.fvmrc) into environment variables which
3-
can then be used to configure the [flutter-action](https://github.com/subosito/flutter-action).
42

5-
## Usage
3+
An action that parses an [FVM](https://github.com/leoafarias/fvm) config file `.fvmrc` and configures the [subosito/flutter-action](https://github.com/subosito/flutter-action)
4+
to install the Flutter SDK.
65

7-
All the sample options below can be combined with each other.
6+
An additional action is provided that just parses the FVM config into outputs & environment variables which
7+
can then be used to manually configure the [subosito/flutter-action](https://github.com/subosito/flutter-action).
8+
9+
## Usage
810

9-
### Basic usage
11+
### Basic setup `kuhnroyal/flutter-fvm-config-action/setup`
1012

11-
The configuration will parse the FVM configuration and use subosito/flutter-action to install & cache the configured Flutter version.
13+
The configuration will parse the FVM configuration and use subosito/flutter-action to install the configured Flutter version.
1214

1315
```yaml
1416
steps:
1517
- uses: actions/checkout@v4
16-
- uses: kuhnroyal/flutter-fvm-config-action@v2
17-
with:
18-
# The setup flag enables installation of the Flutter SDK, will default to true in the next major version (v3)
19-
setup: true
20-
# The cache flag enables caching of the Flutter SDK, default is true - if setup is true
21-
cache: true
18+
- uses: kuhnroyal/flutter-fvm-config-action/setup@develop
2219
```
2320
24-
### Basic usage with manual configuration
21+
### Manual configuration & setup `kuhnroyal/flutter-fvm-config-action/config`
22+
2523
```yaml
2624
steps:
2725
- uses: actions/checkout@v4
28-
- uses: kuhnroyal/flutter-fvm-config-action@v2
26+
- uses: kuhnroyal/flutter-fvm-config-action/config@develop
2927
id: fvm-config-action
3028
- uses: subosito/flutter-action@v2
3129
with:
3230
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
3331
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
3432
```
3533

34+
> [!IMPORTANT]
35+
> The main action `kuhnroyal/flutter-fvm-config-action` will continue to work and can be configured either way.
36+
37+
## Configuration inputs
38+
39+
All the sample options below can be combined with each other.
40+
3641
### Custom config path
42+
43+
If you have a custom path for your `.fvmrc` file, you can set it with the `path` input.
44+
3745
```yaml
3846
steps:
3947
- uses: actions/checkout@v4
40-
- uses: kuhnroyal/flutter-fvm-config-action@v2
41-
id: fvm-config-action
48+
- uses: kuhnroyal/flutter-fvm-config-action/setup@develop
4249
with:
4350
path: 'some-path/.fvmrc'
44-
- uses: subosito/flutter-action@v2
45-
with:
46-
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
47-
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
4851
```
4952

50-
### Reading specific flavor
53+
### FVM flavor
54+
55+
If you require a specific flavor, you can set it with the `flavor` input.
56+
5157
```yaml
5258
steps:
5359
- uses: actions/checkout@v4
54-
- uses: kuhnroyal/flutter-fvm-config-action@v2
55-
id: fvm-config-action
60+
- uses: kuhnroyal/flutter-fvm-config-action/setup@develop
5661
with:
5762
flavor: 'staging'
58-
- uses: subosito/flutter-action@v2
63+
```
64+
65+
### Enable Dart/Flutter analytics
66+
67+
Analytics are disabled by default. To enable them, set `disable-analytics` to `false`.
68+
69+
```yaml
70+
steps:
71+
- uses: actions/checkout@v4
72+
- uses: kuhnroyal/flutter-fvm-config-action/setup@develop
5973
with:
60-
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
61-
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
74+
disable-analytics: false
6275
```
6376

6477
### Caching
6578

6679
This action supports all cache inputs from the [subosito/flutter-action](https://github.com/subosito/flutter-action):
67-
See https://github.com/subosito/flutter-action#caching for more information.
80+
See https://github.com/subosito/flutter-action#caching for more information.

action.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ inputs:
1313
description: 'Setup Flutter via "subosito/flutter-action"? (default: false)'
1414
required: false
1515
default: 'false'
16+
disable-analytics:
17+
description: 'Disable analytics for Flutter and Dart'
18+
required: false
19+
default: 'true'
1620
cache:
1721
description: 'Cache Flutter via "subosito/flutter-action"? (default: true - if setup is true)'
1822
required: false
19-
default: 'true'
23+
default: 'false'
2024
cache-key:
2125
description: 'Identifier for the Flutter SDK cache'
2226
required: false
@@ -44,7 +48,7 @@ runs:
4448
using: 'composite'
4549
steps:
4650
- name: Parse configuration
47-
uses: kuhnroyal/flutter-fvm-config-action/config@v2
51+
uses: kuhnroyal/flutter-fvm-config-action/config@develop
4852
id: config
4953
with:
5054
path: ${{ inputs.path }}
@@ -60,6 +64,11 @@ runs:
6064
cache-path: ${{ inputs.cache-path }}
6165
pub-cache-key: ${{ inputs.pub-cache-key }}
6266
pub-cache-path: ${{ inputs.pub-cache-path }}
67+
- shell: sh
68+
if: inputs.setup == 'true' && inputs.disable-analytics == 'true'
69+
run: |
70+
flutter config --no-analytics
71+
dart --disable-analytics
6372
branding:
6473
icon: 'maximize'
6574
color: 'blue'

config/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Flutter FVM config action'
2-
description: 'Action that parses an FVM config file in order to configure the subosito/flutter-action.'
2+
description: 'Action that parses an FVM config file and provides the version/channel as output/env variables.'
33
author: 'Peter Leibiger'
44
inputs:
55
path:

setup/action.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'Flutter FVM setup action'
2+
description: 'Action that parses an FVM config file and sets up the subosito/flutter-action.'
3+
author: 'Peter Leibiger'
4+
inputs:
5+
path:
6+
description: 'Path to the FVM config file'
7+
required: false
8+
flavor:
9+
description: 'Flavor to use'
10+
required: false
11+
default: ''
12+
disable-analytics:
13+
description: 'Disable analytics for Flutter and Dart'
14+
required: false
15+
default: 'true'
16+
cache:
17+
description: 'Cache Flutter via "subosito/flutter-action"? (default: true - if setup is true)'
18+
required: false
19+
default: 'true'
20+
cache-key:
21+
description: 'Identifier for the Flutter SDK cache'
22+
required: false
23+
default: ''
24+
cache-path:
25+
description: 'Flutter SDK cache path'
26+
required: false
27+
default: ''
28+
pub-cache-key:
29+
description: 'Identifier for the Dart .pub-cache cache'
30+
required: false
31+
default: ''
32+
pub-cache-path:
33+
description: 'Flutter pub cache path'
34+
required: false
35+
default: default
36+
runs:
37+
using: 'composite'
38+
steps:
39+
- name: Parse configuration
40+
uses: kuhnroyal/flutter-fvm-config-action/config@develop
41+
id: config
42+
with:
43+
path: ${{ inputs.path }}
44+
flavor: ${{ inputs.flavor }}
45+
- name: Setup Flutter
46+
uses: subosito/flutter-action@v2
47+
with:
48+
flutter-version: ${{ steps.config.outputs.FLUTTER_VERSION }}
49+
channel: ${{ steps.config.outputs.FLUTTER_CHANNEL }}
50+
cache: ${{ inputs.cache }}
51+
cache-key: ${{ inputs.cache-key }}
52+
cache-path: ${{ inputs.cache-path }}
53+
pub-cache-key: ${{ inputs.pub-cache-key }}
54+
pub-cache-path: ${{ inputs.pub-cache-path }}
55+
- shell: sh
56+
if: inputs.disable-analytics == 'true'
57+
run: |
58+
flutter config --no-analytics
59+
dart --disable-analytics
60+
branding:
61+
icon: 'maximize'
62+
color: 'blue'

0 commit comments

Comments
 (0)