v1.7.1 #28
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows MSIX Release | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| env: | |
| FLUTTER_VERSION: '3.38.0' | |
| jobs: | |
| build-windows-msix: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ env.FLUTTER_VERSION }} | |
| channel: stable | |
| - name: Get Flutter dependencies | |
| run: flutter pub get | |
| - name: Build Windows release | |
| run: flutter build windows --release | |
| - name: Create Store MSIX bundle (unsigned, for Microsoft Store) | |
| run: dart run msix:create --store | |
| - name: Patch Store MSIX manifest for shell integration | |
| shell: pwsh | |
| run: | | |
| $msixFile = Get-ChildItem "build\windows\x64\runner\Release\*.msix" | Select-Object -First 1 | |
| $tempDir = "build\msix_store_temp" | |
| $sdkTool = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\MakeAppx.exe" | Sort-Object -Descending | Select-Object -First 1 | |
| & $sdkTool unpack /p $msixFile.FullName /d $tempDir /o | |
| $manifestPath = "$tempDir\AppxManifest.xml" | |
| $manifest = Get-Content $manifestPath -Raw | |
| # Add desktop6 namespace if not present | |
| if ($manifest -notmatch 'xmlns:desktop6=') { | |
| $manifest = $manifest -replace '(xmlns:rescap="[^"]*")', 'xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6" $1' | |
| # If no rescap namespace either, add both before IgnorableNamespaces | |
| if ($manifest -notmatch 'xmlns:desktop6=') { | |
| $manifest = $manifest -replace '(IgnorableNamespaces=")', 'xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6" $1' | |
| } | |
| } | |
| # Add desktop6 to IgnorableNamespaces | |
| if ($manifest -match 'IgnorableNamespaces="([^"]*)"' -and $Matches[1] -notmatch 'desktop6') { | |
| $manifest = $manifest -replace '(IgnorableNamespaces="[^"]*)', '$1 desktop6' | |
| } | |
| # Add RegistryWriteVirtualization to Properties | |
| if ($manifest -notmatch 'RegistryWriteVirtualization') { | |
| $manifest = $manifest -replace '(</Properties>)', " <desktop6:RegistryWriteVirtualization>disabled</desktop6:RegistryWriteVirtualization>`n `$1" | |
| } | |
| Set-Content $manifestPath $manifest | |
| Remove-Item $msixFile.FullName | |
| & $sdkTool pack /d $tempDir /p $msixFile.FullName /o | |
| Remove-Item -Recurse $tempDir | |
| - name: Bundle MSIX into msixbundle | |
| shell: pwsh | |
| run: | | |
| mkdir store | |
| mkdir bundle | |
| Copy-Item build\windows\x64\runner\Release\*.msix bundle\ | |
| $sdkTool = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\MakeAppx.exe" | Sort-Object -Descending | Select-Object -First 1 | |
| & $sdkTool bundle /d bundle /p store\FxFiles-store.msixbundle | |
| - name: Create sideload MSIX (signed, for direct download) | |
| run: dart run msix:create --install-certificate false | |
| - name: Patch sideload MSIX manifest for shell integration | |
| shell: pwsh | |
| run: | | |
| $msixFile = Get-ChildItem "build\windows\x64\runner\Release\*.msix" | Select-Object -First 1 | |
| $tempDir = "build\msix_sideload_temp" | |
| $sdkTool = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\MakeAppx.exe" | Sort-Object -Descending | Select-Object -First 1 | |
| & $sdkTool unpack /p $msixFile.FullName /d $tempDir /o | |
| $manifestPath = "$tempDir\AppxManifest.xml" | |
| $manifest = Get-Content $manifestPath -Raw | |
| if ($manifest -notmatch 'xmlns:desktop6=') { | |
| $manifest = $manifest -replace '(xmlns:rescap="[^"]*")', 'xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6" $1' | |
| if ($manifest -notmatch 'xmlns:desktop6=') { | |
| $manifest = $manifest -replace '(IgnorableNamespaces=")', 'xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6" $1' | |
| } | |
| } | |
| if ($manifest -match 'IgnorableNamespaces="([^"]*)"' -and $Matches[1] -notmatch 'desktop6') { | |
| $manifest = $manifest -replace '(IgnorableNamespaces="[^"]*)', '$1 desktop6' | |
| } | |
| if ($manifest -notmatch 'RegistryWriteVirtualization') { | |
| $manifest = $manifest -replace '(</Properties>)', " <desktop6:RegistryWriteVirtualization>disabled</desktop6:RegistryWriteVirtualization>`n `$1" | |
| } | |
| Set-Content $manifestPath $manifest | |
| Remove-Item $msixFile.FullName | |
| & $sdkTool pack /d $tempDir /p $msixFile.FullName /o | |
| Remove-Item -Recurse $tempDir | |
| - name: Save sideload MSIX | |
| run: | | |
| mkdir sideload | |
| move build\windows\x64\runner\Release\*.msix sideload\FxFiles.msix | |
| shell: cmd | |
| - name: Upload Store MSIX bundle artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fxfiles-msix-store | |
| path: store/FxFiles-store.msixbundle | |
| retention-days: 30 | |
| - name: Upload sideload MSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fxfiles-msix-sideload | |
| path: sideload/FxFiles.msix | |
| retention-days: 5 | |
| attach-to-release: | |
| needs: build-windows-msix | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Determine release tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
| else | |
| TAG=$(gh api repos/${{ github.repository }}/releases/latest --jq .tag_name) | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Download sideload MSIX | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: fxfiles-msix-sideload | |
| path: msix/ | |
| - name: Upload MSIX to GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| files: msix/FxFiles.msix | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |