Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #12 from Agondev/main
Browse files Browse the repository at this point in the history
Deal w/ #4 and fix v4 bug
  • Loading branch information
erickzanardo authored Jul 12, 2021
2 parents bf9d63a + 236cf4a commit 66e3e7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
steps:
- uses: actions/checkout@v2 # Only works with v2
- uses: subosito/flutter-action@v1
- uses: erickzanardo/flutter-gh-pages@v5
- uses: erickzanardo/flutter-gh-pages@v6
```
To build a project in a folder other that the root, use the `workingDir` property

```yml
...
- uses: erickzanardo/flutter-gh-pages@v5
- uses: erickzanardo/flutter-gh-pages@v6
with:
workingDir: example
```
Expand All @@ -37,7 +37,7 @@ More on web renderers here: https://flutter.dev/docs/development/tools/web-rende

```yml
...
- uses: erickzanardo/flutter-gh-pages@v5
- uses: erickzanardo/flutter-gh-pages@v6
with:
webRenderer: canvaskit
```
Expand All @@ -47,25 +47,25 @@ If you need to change that, the `targetBranch` property can be used

```yml
...
- uses: erickzanardo/flutter-gh-pages@v5
- uses: erickzanardo/flutter-gh-pages@v6
with:
targetBranch: my-gh-pages-branch
```

To pass arguments to the builder with `--dart-define` the `dartDefine` property can be used
To pass arguments to the builder with `--dart-define` the `customArgs` property can be used

```yml
...
- uses: erickzanardo/flutter-gh-pages@v5
- uses: erickzanardo/flutter-gh-pages@v6
with:
dartDefine: "customArg=TEST"
customArgs: --dart-define="simple=example"
```


And consumed in the code via (**const** is mandatory!):
```dart
void main() async {
String arg = const String.fromEnvironment('customArg'); // arg = "TEST"
String arg = const String.fromEnvironment('simple'); // arg = "example"
...
}
```
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ inputs:
targetBranch:
required: false
default: gh-pages
dartDefine:
description: '--dart-define="TEST="custom-args" >> USE IN MAIN USING: >> const t = String.fromEnvironment("TEST"); >> RESULT: >> t = custom-args'
customArgs:
description: 'Custom args like: --dart-define="simple=example"'
required: false
default: ""
default:

runs:
using: 'composite'
Expand All @@ -32,7 +32,7 @@ runs:
- run: flutter pub get
shell: bash
working-directory: ${{inputs.workingDir}}
- run: flutter build web --release --web-renderer=${{inputs.webRenderer}} --dart-define=${{inputs.dartDefine}}
- run: flutter build web --release --web-renderer=${{inputs.webRenderer}} ${{inputs.customArgs}}
shell: bash
working-directory: ${{inputs.workingDir}}
- run: git config user.name github-actions
Expand Down

0 comments on commit 66e3e7b

Please sign in to comment.