Skip to content

Commit

Permalink
Merge pull request #7 from TesteurManiak/feat/wasm-compilation
Browse files Browse the repository at this point in the history
feat: wasm compilation flag
  • Loading branch information
spydon authored Feb 18, 2025
2 parents ab5920b + 64a1ffc commit e5e9d69
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ More on web renderers here: https://flutter.dev/docs/development/tools/web-rende
webRenderer: canvaskit
```

You can also specify if you want to build to WebAssembly with the `compileToWasm` property. If specified the `webRenderer` property will be ignored.

More on WebAssembly here: https://docs.flutter.dev/platform-integration/web/wasm

```yml
...
- uses: bluefireteam/flutter-gh-pages@v7
with:
compileToWasm: true
```

By default, the action will send the files to the `gh-pages` branch, which is the default used by Github Pages.
If you need to change that, the `targetBranch` property can be used

Expand Down
35 changes: 21 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,53 @@
name: 'Deploy Flutter web app to github pages'
description: 'Automates the build and deployment of your Flutter web app on Github gh pages'
author: 'bluefireteam'
name: "Deploy Flutter web app to github pages"
description: "Automates the build and deployment of your Flutter web app on Github gh pages"
author: "bluefireteam"

branding:
color: blue
icon: code

inputs:
webRenderer:
description: 'Which web renderer to be used, default is auto'
description: "Which web renderer to be used, default is auto"
required: false
default: auto
workingDir:
description: 'The directory where the project is (default .)'
description: "The directory where the project is (default .)"
required: false
default: .
targetBranch:
description: "The branch where the build will be pushed, default is gh-pages"
required: false
default: gh-pages
baseHref:
description: 'base href (if applicable)'
description: "base href (if applicable)"
required: false
default: "/"
customArgs:
description: 'Custom args like: --dart-define="simple=example"'
required: false
default:
default: ""
compileToWasm:
description: "Compile to wasm, if used this will ignore the webRenderer flag, default is false"
required: false
default: "false"

runs:
using: 'composite'
using: "composite"
steps:
- run: echo "flutter_version=$(flutter --version | awk '{print $2}' | tr -dc '0-9')" >> $GITHUB_ENV
shell: bash
- run: flutter config --enable-web
shell: bash
working-directory: ${{inputs.workingDir}}
- run: flutter build web --release --web-renderer=${{inputs.webRenderer}} --base-href ${{inputs.baseHref}} ${{inputs.customArgs}}
if: ${{ env.flutter_version < 3290 }}
shell: bash
working-directory: ${{inputs.workingDir}}
- run: flutter build web --release --base-href ${{inputs.baseHref}} ${{inputs.customArgs}}
if: ${{ env.flutter_version >= 3290 }}
- run: |
if [ "${{ inputs.compileToWasm }}" == "true" ]; then
flutter build web --release --wasm --base-href ${{inputs.baseHref}} ${{inputs.customArgs}}
elif [ ${{ env.flutter_version }} -lt 3290 ]; then
flutter build web --release --web-renderer=${{inputs.webRenderer}} --base-href ${{inputs.baseHref}} ${{inputs.customArgs}}
else
flutter build web --release --base-href ${{inputs.baseHref}} ${{inputs.customArgs}}
fi
shell: bash
working-directory: ${{inputs.workingDir}}
- run: git config user.name github-actions
Expand Down

0 comments on commit e5e9d69

Please sign in to comment.