An open-source cross-platform alternative to AirDrop
ci: sub actions for windows builds
Tien Do Namfc42dbdb2845
diff --git a/.github/workflows/build_cli_exe.yml b/.github/workflows/build_windows_cli_exe.ymlsimilarity index 99%rename from .github/workflows/build_cli_exe.ymlrename to .github/workflows/build_windows_cli_exe.ymlindex 1e60a6e1..448d3c63 100644--- a/.github/workflows/build_cli_exe.yml+++ b/.github/workflows/build_windows_cli_exe.yml@@ -2,6 +2,7 @@ name: Build windows CLI exeon:workflow_dispatch:+ workflow_call:jobs:build:diff --git a/.github/workflows/build_exe.yml b/.github/workflows/build_windows_exe.ymlsimilarity index 99%rename from .github/workflows/build_exe.ymlrename to .github/workflows/build_windows_exe.ymlindex cfb86c55..7444e681 100644--- a/.github/workflows/build_exe.yml+++ b/.github/workflows/build_windows_exe.yml@@ -2,6 +2,7 @@ name: Build windows exeon:workflow_dispatch:+ workflow_call:env:FLUTTER_VERSION: "3.41.9"diff --git a/.github/workflows/build_exe_unsigned.yml b/.github/workflows/build_windows_exe_unsigned.ymlsimilarity index 100%rename from .github/workflows/build_exe_unsigned.ymlrename to .github/workflows/build_windows_exe_unsigned.ymldiff --git a/.github/workflows/build_zip_arm64.yml b/.github/workflows/build_windows_zip_arm64.ymlsimilarity index 99%rename from .github/workflows/build_zip_arm64.ymlrename to .github/workflows/build_windows_zip_arm64.ymlindex c615c445..e67885b2 100644--- a/.github/workflows/build_zip_arm64.yml+++ b/.github/workflows/build_windows_zip_arm64.yml@@ -2,6 +2,7 @@ name: Build windows arm64 zipon:workflow_dispatch:+ workflow_call:# Windows ARM64 requires beta: stable (3.41.9) has no windows-arm64 artifacts and silently falls back to an x64 build.# Switch back to the shared stable FLUTTER_VERSION once windows-arm64 reaches stable.diff --git a/.github/workflows/build_zip_x64.yml b/.github/workflows/build_windows_zip_x64.ymlsimilarity index 99%rename from .github/workflows/build_zip_x64.ymlrename to .github/workflows/build_windows_zip_x64.ymlindex 7cffc79f..e497a559 100644--- a/.github/workflows/build_zip_x64.yml+++ b/.github/workflows/build_windows_zip_x64.yml@@ -2,6 +2,7 @@ name: Build windows zipon:workflow_dispatch:+ workflow_call:env:FLUTTER_VERSION: "3.41.9"diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 28aa0d19..39620bf5 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -355,336 +355,26 @@ jobs:path: ./*.AppImagebuild_windows_zip_x86_64:- needs: build- runs-on: windows-latest- environment: packaging+ uses: ./.github/workflows/build_windows_zip_x64.yml+ secrets: inheritpermissions:id-token: write # OIDC token for Azure logincontents: read- 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: Azure login- uses: azure/login@v2- with:- client-id: ${{ secrets.AZURE_CLIENT_ID }}- tenant-id: ${{ secrets.AZURE_TENANT_ID }}- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}-- # Sign before "Add DLL files" so the Microsoft-signed CRT DLLs keep their original signature- - name: Sign app binaries (Azure Trusted Signing)- uses: azure/trusted-signing-action@v0- with:- endpoint: https://neu.codesigning.azure.net/- trusted-signing-account-name: tienisto- certificate-profile-name: localsend- files-folder: ${{ github.workspace }}\app\build\windows\x64\runner\Release- files-folder-filter: exe,dll- file-digest: SHA256- timestamp-rfc3161: http://timestamp.acs.microsoft.com- timestamp-digest: SHA256-- - name: Verify signature- continue-on-error: true- run: |- $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe' | Select-Object -Last 1- & $signtool.FullName verify /pa /v app\build\windows\x64\runner\Release\localsend_app.exe-- - name: Create empty settings.json- working-directory: app- run: echo {} > build/windows/x64/runner/Release/settings.json-- - name: Add DLL files- working-directory: app- run: |- Copy-Item ../support/build/windows/x64/msvcp140.dll build/windows/x64/runner/Release/- Copy-Item ../support/build/windows/x64/vcruntime140.dll build/windows/x64/runner/Release/- Copy-Item ../support/build/windows/x64/vcruntime140_1.dll build/windows/x64/runner/Release/-- # The MSIX helper only makes sense for the installer; portable users should not register an MSIX package- - name: Remove MSIX helper from portable bundle- working-directory: app- run: |- Remove-Item build/windows/x64/runner/Release/localsend_msix_helper.msix- Remove-Item build/windows/x64/runner/Release/install_msix_helper.ps1- Remove-Item build/windows/x64/runner/Release/localsend_app.exe.manifest-- - name: Zip compiled files- working-directory: app- run: Compress-Archive -Path build/windows/x64/runner/Release/* -DestinationPath "LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.zip"-- - name: Upload zip- uses: actions/upload-artifact@v6- with:- name: windows-zip-x86-64-result- path: app/LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.zip- if-no-files-found: error-build_windows_zip_arm_64:- needs: build- runs-on: windows-11-arm- environment: packaging+ uses: ./.github/workflows/build_windows_zip_arm64.yml+ secrets: inheritpermissions:id-token: write # OIDC token for Azure logincontents: read- # Windows ARM64 requires beta: stable (3.41.9) has no windows-arm64 artifacts and silently falls back to an x64 build.- # Switch back to the shared stable FLUTTER_VERSION once windows-arm64 reaches stable.- env:- FLUTTER_VERSION: "3.47.0-0.4.pre"-- steps:- - name: Fix long file paths- run: git config --system core.longpaths true-- - name: Checkout repository- uses: actions/checkout@v6-- # Flutter doesn't provide Windows ARM64 binaries, so clone the SDK from GitHub instead of using a setup action.- - name: Setup Flutter SDK- run: |- git clone --depth 1 --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git $env:USERPROFILE\flutter- Add-Content $env:GITHUB_PATH "$env:USERPROFILE\flutter\bin"- & "$env:USERPROFILE\flutter\bin\flutter.bat" --version-- # Flutter silently falls back to an x64 Dart SDK when arm64 artifacts are missing, which would produce an x64 build- - name: Verify native arm64 toolchain- run: |- $dartVersion = & "$env:USERPROFILE\flutter\bin\dart.bat" --version 2>&1 | Out-String- Write-Host $dartVersion- if ($dartVersion -notmatch 'windows_arm64') {- Write-Error "Dart SDK is not windows_arm64 - Flutter fell back to x64"- exit 1- }-- # Required by the CMake install step (app/windows/CMakeLists.txt installs localsend_msix_helper.msix).- # The checked-in manifest declares x64; patch it so the package identity matches the arm64 executable.- - name: Build MSIX helper- run: |- $manifest = 'support\build\msix\content\AppxManifest.xml'- (Get-Content $manifest) -replace 'ProcessorArchitecture="x64"', 'ProcessorArchitecture="arm64"' | Set-Content $manifest- if (-not (Select-String -Path $manifest -Pattern 'ProcessorArchitecture="arm64"' -Quiet)) {- Write-Error "Failed to patch ProcessorArchitecture in $manifest"- exit 1- }- $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: Azure login- uses: azure/login@v2- with:- client-id: ${{ secrets.AZURE_CLIENT_ID }}- tenant-id: ${{ secrets.AZURE_TENANT_ID }}- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}-- # Sign before "Add DLL files" so the Microsoft-signed CRT DLLs keep their original signature- - name: Sign app binaries (Azure Trusted Signing)- uses: azure/trusted-signing-action@v0- with:- endpoint: https://neu.codesigning.azure.net/- trusted-signing-account-name: tienisto- certificate-profile-name: localsend- files-folder: ${{ github.workspace }}\app\build\windows\arm64\runner\Release- files-folder-filter: exe,dll- file-digest: SHA256- timestamp-rfc3161: http://timestamp.acs.microsoft.com- timestamp-digest: SHA256-- - name: Verify signature- continue-on-error: true- run: |- $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\arm64\signtool.exe' | Select-Object -Last 1- & $signtool.FullName verify /pa /v app\build\windows\arm64\runner\Release\localsend_app.exe-- - name: Create empty settings.json- working-directory: app- run: echo {} > build/windows/arm64/runner/Release/settings.json-- # support/build/windows only carries x64 runtime DLLs, so take the arm64 ones from the Visual Studio redist- - name: Add DLL files- working-directory: app- run: |- $crt = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\*\VC\Redist\MSVC\*\arm64\Microsoft.VC143.CRT' | Select-Object -Last 1- Copy-Item "$($crt.FullName)\msvcp140.dll" build/windows/arm64/runner/Release/- Copy-Item "$($crt.FullName)\vcruntime140.dll" build/windows/arm64/runner/Release/- Copy-Item "$($crt.FullName)\vcruntime140_1.dll" build/windows/arm64/runner/Release/-- # The MSIX helper only makes sense for the installer; portable users should not register an MSIX package- - name: Remove MSIX helper from portable bundle- working-directory: app- run: |- Remove-Item build/windows/arm64/runner/Release/localsend_msix_helper.msix- Remove-Item build/windows/arm64/runner/Release/install_msix_helper.ps1- Remove-Item build/windows/arm64/runner/Release/localsend_app.exe.manifest-- - name: Zip compiled files- working-directory: app- run: Compress-Archive -Path build/windows/arm64/runner/Release/* -DestinationPath "LocalSend-${{ needs.build.outputs.version }}-windows-arm-64.zip"-- - name: Upload zip- uses: actions/upload-artifact@v6- with:- name: windows-zip-arm-64-result- path: app/LocalSend-${{ needs.build.outputs.version }}-windows-arm-64.zip- if-no-files-found: error-build_windows_exe_x86_64:- needs: build- runs-on: windows-latest- environment: packaging+ uses: ./.github/workflows/build_windows_exe.yml+ secrets: inheritpermissions:id-token: write # OIDC token for Azure logincontents: read- 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"-- - name: Azure login- uses: azure/login@v2- with:- client-id: ${{ secrets.AZURE_CLIENT_ID }}- tenant-id: ${{ secrets.AZURE_TENANT_ID }}- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}-- - 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-- # The sparse package needs its own signature (Add-AppxPackage rejects unsigned packages);- # signing the surrounding installer does not cover it. Sign before "flutter build windows"- # so CMake bundles the signed msix into the Release directory.- - name: Sign MSIX helper (Azure Trusted Signing)- uses: azure/trusted-signing-action@v0- with:- endpoint: https://neu.codesigning.azure.net/- trusted-signing-account-name: tienisto- certificate-profile-name: localsend- files-folder: ${{ github.workspace }}\app\windows- files-folder-filter: msix- file-digest: SHA256- timestamp-rfc3161: http://timestamp.acs.microsoft.com- timestamp-digest: SHA256-- - name: Verify MSIX signature- continue-on-error: true- run: |- $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe' | Select-Object -Last 1- & $signtool.FullName verify /pa /v 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: Sign app binaries (Azure Trusted Signing)- uses: azure/trusted-signing-action@v0- with:- endpoint: https://neu.codesigning.azure.net/- trusted-signing-account-name: tienisto- certificate-profile-name: localsend- files-folder: ${{ github.workspace }}\app\build\windows\x64\runner\Release- files-folder-filter: exe,dll- file-digest: SHA256- timestamp-rfc3161: http://timestamp.acs.microsoft.com- timestamp-digest: SHA256-- - 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-- # Inno signs the setup exe AND the embedded uninstaller at compile time via the MySignTool- # command; signing the finished installer afterwards would leave unins000.exe unsigned.- - name: Prepare Trusted Signing sign tool for Inno Setup- run: |- $dir = "${{ runner.temp }}\trusted-signing"- New-Item -ItemType Directory -Force -Path $dir | Out-Null- nuget install Microsoft.Trusted.Signing.Client -x -OutputDirectory $dir- $dlib = "$dir\Microsoft.Trusted.Signing.Client\bin\x64\Azure.CodeSigning.Dlib.dll"- if (-not (Test-Path $dlib)) { Write-Error "Azure.CodeSigning.Dlib.dll not found"; exit 1 }- $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe' | Select-Object -Last 1- Set-Content "$dir\metadata.json" -Encoding ascii -Value @"- {- "Endpoint": "https://neu.codesigning.azure.net/",- "CodeSigningAccountName": "tienisto",- "CertificateProfileName": "localsend"- }- "@- Set-Content "$dir\sign.cmd" -Encoding ascii -Value @"- @echo off- "$($signtool.FullName)" sign /v /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 /dlib "$dlib" /dmdf "$dir\metadata.json" %1- "@-- - name: Compile installer (signed)- run: iscc "/SMySignTool=${{ runner.temp }}\trusted-signing\sign.cmd `$f" "/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: Verify signature- continue-on-error: true- run: |- $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe' | Select-Object -Last 1- & $signtool.FullName verify /pa /v "${{ runner.temp }}\inno-result\LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.exe"-- - name: Upload signed installer- uses: actions/upload-artifact@v6- with:- name: windows-exe-x86-64-result- path: ${{ runner.temp }}\inno-result\LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.exe- if-no-files-found: error-build_cli_linux:needs: buildstrategy:@@ -718,68 +408,12 @@ jobs:if-no-files-found: errorbuild_cli_windows_exe:- needs: build- strategy:- fail-fast: false- matrix:- include:- - runner: windows-latest- suffix: x86-64- signtool_arch: x64- - runner: windows-11-arm- suffix: arm-64- signtool_arch: arm64- runs-on: ${{ matrix.runner }}- environment: packaging+ uses: ./.github/workflows/build_windows_cli_exe.yml+ secrets: inheritpermissions:id-token: write # OIDC token for Azure logincontents: read- steps:- - name: Checkout repository- uses: actions/checkout@v6-- - name: Install Rust- run: rustup toolchain install # version from rust-toolchain.toml-- - name: Compile CLI- run: cargo build --release --package localsend-cli-- - name: Rename CLI executable- run: Rename-Item -Path "target\release\localsend-cli.exe" -NewName "LocalSend-CLI-${{ needs.build.outputs.version }}-windows-${{ matrix.suffix }}.exe"-- - name: Azure login- uses: azure/login@v2- with:- client-id: ${{ secrets.AZURE_CLIENT_ID }}- tenant-id: ${{ secrets.AZURE_TENANT_ID }}- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}-- - name: Sign CLI (Azure Trusted Signing)- uses: azure/trusted-signing-action@v0- with:- endpoint: https://neu.codesigning.azure.net/- trusted-signing-account-name: tienisto- certificate-profile-name: localsend- files-folder: ${{ github.workspace }}\target\release- files-folder-filter: exe- file-digest: SHA256- timestamp-rfc3161: http://timestamp.acs.microsoft.com- timestamp-digest: SHA256-- - name: Verify signature- continue-on-error: true- run: |- $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\${{ matrix.signtool_arch }}\signtool.exe' | Select-Object -Last 1- & $signtool.FullName verify /pa /v "target\release\LocalSend-CLI-${{ needs.build.outputs.version }}-windows-${{ matrix.suffix }}.exe"-- - name: Upload CLI- uses: actions/upload-artifact@v6- with:- name: windows-cli-exe-${{ matrix.suffix }}-result- path: target\release\LocalSend-CLI-${{ needs.build.outputs.version }}-windows-${{ matrix.suffix }}.exe- if-no-files-found: error-release:needs:- build