Skip to content

Commit a286907

Browse files
committed
Initial commit
0 parents  commit a286907

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Zennon Gosalvez
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# GitHub Action — Get Flutter Version
2+
3+
This GitHub Action (written in composite run steps) allows you to leverage GitHub Actions to get the [Flutter](https://flutter.dev) environment version from the pubspec file. This is primarily used before using the [Flutter action](https://github.com/marketplace/actions/flutter-action).
4+
5+
## Usage
6+
### Pre-requisites
7+
Create a workflow `.yml` file in your `.github/workflows` directory. An [example workflow](#example-workflow---create-a-release) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).
8+
9+
### Inputs
10+
None.
11+
12+
### Outputs
13+
* `version`: The Flutter version
14+
15+
### Common workflow
16+
17+
1. Your `pubspec.yaml` file must contain the Flutter version under the `environment:flutter:` key. For example:
18+
```yaml
19+
environment:
20+
flutter: 1.22.4
21+
```
22+
2. Use the action's output as an input to [Flutter action](https://github.com/marketplace/actions/flutter-action). For example:
23+
```yaml
24+
on: push
25+
26+
name: Sample Workflow
27+
28+
jobs:
29+
build:
30+
name: Examaple
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v2
35+
- name: Get Flutter Version
36+
id: get-flutter-version
37+
use: zgosalvez/[email protected]
38+
- name: Set up Flutter
39+
uses: subosito/flutter-action@v1
40+
with:
41+
flutter-version: ${{ steps.get-flutter-version.outputs.version }}
42+
```
43+
44+
## Shout-out
45+
A special mention goes to [@daohoangson](https://github.com/daohoangson), who came up with the solution at [subosito/flutter-action/issues/47#issuecomment-675821988](https://github.com/subosito/flutter-action/issues/47#issuecomment-675821988).
46+
47+
## License
48+
The scripts and documentation in this project are released under the [MIT License](LICENSE)

action.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Get Flutter Version'
2+
description: 'Get the Flutter environment version from the pubspec file'
3+
outputs:
4+
version:
5+
description: "The Flutter version"
6+
value: ${{ steps.get-flutter-version.outputs.version }}
7+
runs:
8+
using: "composite"
9+
steps:
10+
- id: get-flutter-version
11+
run: | # https://github.com/subosito/flutter-action/issues/47#issuecomment-675821988
12+
set -e
13+
14+
brew install yq
15+
echo "::set-output name=version::$( yq read pubspec.yaml environment.flutter )"
16+
shell: bash
17+
branding:
18+
icon: 'minimize'
19+
color: 'blue'

0 commit comments

Comments
 (0)