forked from subosito/flutter-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
142 lines (134 loc) · 4.72 KB
/
action.yaml
File metadata and controls
142 lines (134 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Set up Flutter
description: Setup your runner with Flutter environment
author: Alif Rachmawadi
branding:
icon: maximize
color: blue
inputs:
channel:
description: The Flutter build release channel
required: false
default: stable
flutter-version:
description: The Flutter version to make available on the path
required: false
default: ""
flutter-version-file:
description: The pubspec.yaml file with exact Flutter version defined
required: false
default: ""
architecture:
description: The architecture of Flutter SDK executable (x64 or arm64)
required: false
default: "${{ runner.arch }}"
cache:
description: Cache the Flutter SDK
required: false
default: "false"
cache-key:
description: Identifier for the Flutter SDK cache
required: false
default: ""
cache-path:
description: Flutter SDK cache path
required: false
default: ""
pub-cache-key:
description: Identifier for the Dart .pub-cache cache
required: false
default: ""
pub-cache-path:
description: Flutter pub cache path
required: false
default: default
dry-run:
description: If true, get outputs but do not install Flutter
required: false
default: "false"
git-source:
description: Git clone source
required: false
default: "https://github.com/flutter/flutter.git"
outputs:
CHANNEL:
value: "${{ steps.flutter-action.outputs.CHANNEL }}"
description: The selected Flutter release channel
VERSION:
value: "${{ steps.flutter-action.outputs.VERSION }}"
description: The selected Flutter version
ARCHITECTURE:
value: "${{ steps.flutter-action.outputs.ARCHITECTURE }}"
description: The selected Flutter CPU architecture
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
PUB-CACHE-KEY:
value: "${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}"
description: Key used to cache the pub dependencies
PUB-CACHE-PATH:
value: "${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}"
description: Path to pub cache
GIT_SOURCE:
value: "${{ steps.flutter-action.outputs.GIT_SOURCE }}"
description: Git source of Flutter SDK repository to clone
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"
runs:
using: composite
steps:
# This is a cross-platform composite action that needs yq in order to parse
# the pubspec.yaml file.
# 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
if: runner.os == 'Windows' && inputs.flutter-version-file != ''
run: choco install yq
shell: bash
- name: Make setup script executable
run: chmod +x "$GITHUB_ACTION_PATH/setup.sh"
shell: bash
- name: Set action inputs
id: flutter-action
shell: bash
run: |
$GITHUB_ACTION_PATH/setup.sh -p \
-n '${{ inputs.flutter-version }}' \
-f '${{ inputs.flutter-version-file }}' \
-a '${{ inputs.architecture }}' \
-k '${{ inputs.cache-key }}' \
-c '${{ inputs.cache-path }}' \
-l '${{ inputs.pub-cache-key }}' \
-d '${{ inputs.pub-cache-path }}' \
-g '${{ inputs.git-source }}' \
${{ inputs.channel }}
- name: Cache Flutter
id: cache-flutter
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
if: ${{ inputs.cache == 'true' }}
with:
path: ${{ steps.flutter-action.outputs.CACHE-PATH }}
key: ${{ steps.flutter-action.outputs.CACHE-KEY }}
- name: Cache pub dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
id: cache-pub
if: ${{ inputs.cache == 'true' }}
with:
path: ${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
key: ${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}-${{ hashFiles('**/pubspec.lock') }}
- name: Run setup script
shell: bash
if: ${{ inputs.dry-run != 'true' && inputs.dry-run != true }}
run: |
$GITHUB_ACTION_PATH/setup.sh \
-n '${{ steps.flutter-action.outputs.VERSION }}' \
-a '${{ steps.flutter-action.outputs.ARCHITECTURE }}' \
-c '${{ steps.flutter-action.outputs.CACHE-PATH }}' \
-d '${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}' \
${{ steps.flutter-action.outputs.CHANNEL }}