|
| 1 | +name: Test MSIX Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + paths: |
| 9 | + - 'packaging/msix/**' |
| 10 | + - '.github/workflows/test-msix.yml' |
| 11 | + - 'Cargo.toml' |
| 12 | + - 'src/**' |
| 13 | + |
| 14 | +jobs: |
| 15 | + test-build: |
| 16 | + name: Test MSIX Packaging |
| 17 | + runs-on: windows-latest |
| 18 | + env: |
| 19 | + RUSTFLAGS: -C target-feature=+crt-static |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install Rust |
| 24 | + uses: dtolnay/rust-toolchain@stable |
| 25 | + |
| 26 | + - name: Build |
| 27 | + run: cargo build --release |
| 28 | + |
| 29 | + - name: Extract version |
| 30 | + id: version |
| 31 | + shell: pwsh |
| 32 | + run: | |
| 33 | + $ver = (Select-String -Path "Cargo.toml" -Pattern '^version = "([^"]+)"').Matches.Groups[1].Value |
| 34 | + echo "SEMVER=$ver" >> $env:GITHUB_OUTPUT |
| 35 | + echo "MSIX_VER=$ver.0" >> $env:GITHUB_OUTPUT |
| 36 | +
|
| 37 | + - name: Stamp version into manifest |
| 38 | + shell: pwsh |
| 39 | + run: | |
| 40 | + $manifest = Get-Content packaging/msix/AppxManifest.xml -Raw |
| 41 | + $manifest = $manifest -replace 'Version="[^"]*"', "Version=`"${{ steps.version.outputs.MSIX_VER }}`"" |
| 42 | + Set-Content packaging/msix/AppxManifest.xml $manifest |
| 43 | +
|
| 44 | + - name: Prepare package layout |
| 45 | + shell: pwsh |
| 46 | + run: | |
| 47 | + $layout = "target/msix/layout" |
| 48 | + New-Item -ItemType Directory -Path "$layout/Assets" -Force | Out-Null |
| 49 | +
|
| 50 | + Copy-Item target/release/fount.exe $layout/ |
| 51 | + Copy-Item packaging/msix/AppxManifest.xml $layout/ |
| 52 | +
|
| 53 | + $sizes = @{ |
| 54 | + "StoreLogo" = "50x50" |
| 55 | + "Square44x44Logo" = "44x44" |
| 56 | + "Square150x150Logo" = "150x150" |
| 57 | + "Wide310x150Logo" = "310x150" |
| 58 | + "LargeSquareLogo" = "310x310" |
| 59 | + } |
| 60 | +
|
| 61 | + foreach ($entry in $sizes.GetEnumerator()) { |
| 62 | + magick assets/icons/FountTUI_Logo.png ` |
| 63 | + -resize $entry.Value ` |
| 64 | + -gravity center ` |
| 65 | + -background "#1a1b26" ` |
| 66 | + -extent $entry.Value ` |
| 67 | + "$layout/Assets/$($entry.Key).png" |
| 68 | + } |
| 69 | +
|
| 70 | + - name: Create MSIX |
| 71 | + shell: pwsh |
| 72 | + run: | |
| 73 | + $sdkDir = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\10.*" -Directory | Sort-Object Name -Descending | Select-Object -First 1 |
| 74 | + $makeappx = Join-Path $sdkDir.FullName "x64\MakeAppx.exe" |
| 75 | + & $makeappx pack /d target/msix/layout /p target/msix/FountTUI-TEST-BUILD.msix /o |
| 76 | +
|
| 77 | + - name: Upload Artifact |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: FountTUI-Test-MSIX |
| 81 | + path: target/msix/FountTUI-TEST-BUILD.msix |
| 82 | + retention-days: 5 |
0 commit comments