From 8b1af7286dbf738469132058d71fef1a5f6b1bd0 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 6 Jun 2024 14:30:38 +0200 Subject: [PATCH 1/4] feat: add compileToWasm flag --- action.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index fd04ce3..0ff7d27 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ -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 @@ -8,32 +8,42 @@ branding: 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" 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: 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}} + - run: | + if [[ "${{inputs.compileToWasm}}" == "true" ]]; then + flutter build web --release --wasm --base-href ${{inputs.baseHref}} ${{inputs.customArgs}} + else + flutter build web --release --web-renderer=${{inputs.webRenderer}} --base-href ${{inputs.baseHref}} ${{inputs.customArgs}} + fi shell: bash working-directory: ${{inputs.workingDir}} - run: git config user.name github-actions From fcbb075dd1aa7f4690621a780b7b19fe3d5b80b2 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 6 Jun 2024 14:38:40 +0200 Subject: [PATCH 2/4] doc: added documentation to README --- README.md | 9 +++++++++ action.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 97af758..3de3ad2 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,15 @@ 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. + +```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 diff --git a/action.yml b/action.yml index 0ff7d27..749210e 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,7 @@ inputs: required: false default: . targetBranch: - description: "The branch where the build will be pushed" + description: "The branch where the build will be pushed, default is gh-pages" required: false default: gh-pages baseHref: From e0ebcf0bdfac5ff950ed05a7797a34f137e685a9 Mon Sep 17 00:00:00 2001 From: Guillaume Roux Date: Thu, 6 Jun 2024 14:40:32 +0200 Subject: [PATCH 3/4] doc: added link to Flutter wasm documentation --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3de3ad2..990ed39 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,9 @@ 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. +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 ... From 64a1ffc0608ea5314bb39a153a7e92f877eca1c6 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Tue, 18 Feb 2025 16:46:05 +0100 Subject: [PATCH 4/4] Simply ifs --- action.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index 9c856e7..f8cab2b 100644 --- a/action.yml +++ b/action.yml @@ -40,16 +40,14 @@ runs: - run: flutter config --enable-web shell: bash working-directory: ${{inputs.workingDir}} - - run: flutter build web --release --wasm --base-href ${{inputs.baseHref}} ${{inputs.customArgs}} - if: ${{ inputs.compileToWasm == 'true' }} - 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 && inputs.compileToWasm != 'true' }} - shell: bash - working-directory: ${{inputs.workingDir}} - - run: flutter build web --release --base-href ${{inputs.baseHref}} ${{inputs.customArgs}} - if: ${{ env.flutter_version >= 3290 && inputs.compileToWasm != 'true' }} + - 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