leanflutter / flutter_distributor

An all-in-one Flutter application packaging and distribution tool, providing you with a one-stop solution to meet various distribution needs.
https://distributor.leanflutter.dev/
MIT License
857 stars 119 forks source link

Windows inno build failure when using setup_icon_file #228

Open AminBhst opened 1 week ago

AminBhst commented 1 week ago

Hello. The setup_icon_file property is nowhere to be found in the documentation but I did find a merge request that added this property. Here is my make_config.yaml

app_id: 5B599538-42B1-4826-A479-AF079F21A65D
publisher: Amin Beheshti
publisher_url: https://github.com/AminBhst/brisk
display_name: Brisk
create_desktop_icon: true
install_dir_name: "{autopf}\\Brisk"
setup_icon_file: assets\\icons\\logo.ico
locales:
  - en

After running the workflow with the setup_icon_file set, it results in a build failure:

 Preparing Setup program executable
   Updating icons (SETUP.E32)
Error on line 15 in D:\a\brisk\brisk\dist\1.4.6+15\brisk-1.4.6+15-windows-setup_exe.iss: The system cannot find the path specified.
Compile aborted.
MakeError
#0      AppPackageMakerExe._make (package:flutter_app_packager/src/makers/exe/app_package_maker_exe.dart:49:7)
<asynchronous suspension>
#1      FlutterDistributor.package (package:flutter_distributor/src/flutter_distributor.dart:182:35)
<asynchronous suspension>
#2      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>

Unhandled exception:
MakeError
#0      AppPackageMakerExe._make (package:flutter_app_packager/src/makers/exe/app_package_maker_exe.dart:49:7)
<asynchronous suspension>
#1      FlutterDistributor.package (package:flutter_distributor/src/flutter_distributor.dart:182:35)
<asynchronous suspension>
#2      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>

The exe is built eventually, however, the file is corrupted as it failed during the build. The crazy thing is that the icon is properly set for the corrupted exe file. It does work fine if I set the path explicitly like this: setup_icon_file: D:\\a\\brisk\\brisk\\assets\\icons\\logo.ico. However, this is obviously not ideal. Is there any way to use ${{ github.workspace }} for flutter distributor?

AminBhst commented 1 week ago

My current workaround is to add a job step that replaces the icon path to the proper explicit value:

make_config.yaml:

app_id: 5B599538-42B1-4826-A479-AF079F21A65D
publisher: Amin Beheshti
publisher_url: https://github.com/AminBhst/brisk
display_name: Brisk
create_desktop_icon: true
install_dir_name: "{autopf}\\Brisk"
setup_icon_file: PLACEHOLDER_ICON_PATH
locales:
  - en

This step added to the workflow file:

      - name: Set proper icon path
        run: |
          $iconPath = "${{ github.workspace }}\\assets\\icons\\logo.ico"
          (Get-Content windows/packaging/exe/make_config.yaml) -replace 'PLACEHOLDER_ICON_PATH', $iconPath | Set-Content windows/packaging/exe/make_config.yaml