Skip to content

An open-source cross-platform alternative to AirDrop

ci: add unsigned exe

Tien Do Namdaa652708fa4
diff --git a/.github/workflows/build_exe_unsigned.yml b/.github/workflows/build_exe_unsigned.yml
new file mode 100644
index 00000000..1de7ee2a
--- /dev/null
+++ b/.github/workflows/build_exe_unsigned.yml
@@ -0,0 +1,75 @@
+name: Build windows exe (unsigned)
+
+on:
+ workflow_dispatch:
+
+env:
+ FLUTTER_VERSION: "3.41.9"
+
+jobs:
+ build:
+ runs-on: ubuntu-24.04
+ outputs:
+ version: ${{ steps.get_version.outputs.version }}
+
+ steps:
+ - uses: actions/checkout@v6
+
+ - name: Get version from pubspec.yaml
+ id: get_version
+ run: |
+ VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' app/pubspec.yaml)
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+
+ build_windows_exe_x86_64:
+ needs: build
+ runs-on: windows-latest
+
+ steps:
+ - name: Fix long file paths
+ run: git config --system core.longpaths true
+
+ - name: Checkout repository
+ uses: actions/checkout@v6
+
+ - uses: subosito/flutter-action@v2
+ with:
+ flutter-version: ${{ env.FLUTTER_VERSION }}
+ channel: "stable"
+
+ # Required by the CMake install step (app/windows/CMakeLists.txt installs localsend_msix_helper.msix)
+ - name: Build MSIX helper
+ run: |
+ $makepri = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\makepri.exe' | Select-Object -Last 1
+ & $makepri.FullName new /pr support\build\msix\content /cf support\build\msix\priconfig.xml /mn support\build\msix\content\AppxManifest.xml /of support\build\msix\content\resources.pri /o
+ & 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe' pack /o /d support\build\msix\content /nv /p app\windows\localsend_msix_helper.msix
+
+ - name: Dependencies
+ working-directory: app
+ run: flutter pub get
+
+ - name: Compile for Windows
+ working-directory: app
+ run: flutter build windows
+
+ - name: Prepare Inno Setup payload
+ run: |
+ New-Item -ItemType Directory -Force -Path "${{ runner.temp }}\inno" | Out-Null
+ Copy-Item -Path "app\build\windows\x64\runner\Release\*" -Destination "${{ runner.temp }}\inno" -Recurse
+ Copy-Item -Path "app\assets\packaging\logo.ico" -Destination "${{ runner.temp }}\inno"
+ Copy-Item -Path "support\build\windows\x64\*" -Destination "${{ runner.temp }}\inno" -Recurse
+ New-Item -ItemType Directory -Force -Path "${{ runner.temp }}\inno-result" | Out-Null
+
+ # SkipMsixHelper: the helper would be unsigned and Add-AppxPackage rejects unsigned packages
+ - name: Compile installer (unsigned)
+ run: iscc /DSkipSignTool /DSkipMsixHelper "/DPayloadDir=${{ runner.temp }}\inno" "/DResultDir=${{ runner.temp }}\inno-result" support\scripts\compile_windows_exe-inno.iss
+
+ - name: Rename installer
+ run: Rename-Item -Path "${{ runner.temp }}\inno-result\localsend.exe" -NewName "LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.exe"
+
+ - name: Upload installer
+ uses: actions/upload-artifact@v6
+ with:
+ name: windows-exe-x86-64-unsigned
+ path: ${{ runner.temp }}\inno-result\LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.exe
+ if-no-files-found: error
diff --git a/support/scripts/compile_windows_exe-inno.iss b/support/scripts/compile_windows_exe-inno.iss
index 9b57d47b..4bacba35 100644
--- a/support/scripts/compile_windows_exe-inno.iss
+++ b/support/scripts/compile_windows_exe-inno.iss
@@ -83,10 +83,13 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
[Files]
Source: "{#PayloadDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
-Source: "{#PayloadDir}\{#MyAppExeName}.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#PayloadDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#PayloadDir}\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs
+; Unsigned builds pass /DSkipMsixHelper: Add-AppxPackage rejects unsigned packages, so ship without the MSIX helper (like the portable zip)
+#ifndef SkipMsixHelper
+Source: "{#PayloadDir}\{#MyAppExeName}.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#PayloadDir}\{#MyAppMsixHelper}"; DestDir: "{app}"; Flags: ignoreversion
+#endif
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
@@ -95,7 +98,11 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
+#ifndef SkipMsixHelper
Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -Command Add-AppxPackage .\localsend_msix_helper.msix -ExternalLocation $(Get-Location)"; WorkingDir: {app}; Flags: nowait runhidden
+#endif
[UninstallRun]
+#ifndef SkipMsixHelper
Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -Command Get-AppxPackage LocalSend.App | Remove-AppxPackage"; Flags: nowait runhidden
+#endif