Update to WASDK 2.1 #125
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: Build (WinUI 3) | |
| on: | |
| push: | |
| branches: [ "reset-winui3" ] | |
| pull_request: | |
| branches: [ "reset-winui3" ] | |
| workflow_call: | |
| inputs: | |
| release: | |
| required: true | |
| type: boolean | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| channel: [AppInstaller, Store] | |
| include: | |
| - channel: AppInstaller | |
| publisher: | |
| "CN=Đặng Bình Minh, O=Đặng Bình Minh, L=Hà Nội, C=VN" | |
| pkgName: | |
| "MicaForEveryone.MicaForEveryone2" | |
| - channel: Store | |
| publisher: | |
| "CN=95B8F56A-76FA-4743-83B0-5312C49D625D" | |
| pkgName: | |
| "DongleInsovaki.MicaForEveryone" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v5 | |
| - name: Change package identity | |
| run: | | |
| $manifestPath = "MicaForEveryone.App\Package.appxmanifest" | |
| $manifest = [xml](Get-Content $manifestPath) | |
| $manifest.Package.Identity.Publisher = "${{ matrix.publisher }}" | |
| $manifest.Package.Identity.Name = "${{ matrix.pkgName }}" | |
| $manifest.Save($manifestPath) | |
| - name: Login to Azure | |
| uses: azure/login@v3 | |
| if: ${{ inputs.release }} | |
| with: | |
| client-id: ${{ secrets.TS_CLIENT_ID }} | |
| tenant-id: ${{ secrets.TS_TENANT_ID }} | |
| subscription-id: ${{ secrets.TS_SUBSCRIPTION_ID }} | |
| - name: Create Trusted Signing configuration | |
| if: ${{ inputs.release }} | |
| run: | | |
| $config = @{ | |
| Endpoint = "${{ secrets.TS_ENDPOINT }}" | |
| CodeSigningAccountName = "${{ secrets.TS_ACCOUNT }}" | |
| CertificateProfileName = "${{ secrets.TS_CERT }}" | |
| } | |
| $json = $config | ConvertTo-Json | |
| $json | Out-File -FilePath "${{ github.workspace }}\trusted-signing.json" | |
| - name: Set App Center connection string | |
| if: ${{ inputs.release }} | |
| run: | | |
| $xmlPath = "${{ github.workspace}}\MicaForEveryone.App\appsettings.resw" | |
| [xml]$xml = Get-Content -Path $xmlPath | |
| $xml.root.data | Where-Object { $_.name -eq "AppCenterConnectionString" } | ForEach-Object { | |
| $_.value = "${{ secrets.AC_STRING }}" | |
| } | |
| $xml.Save($xmlPath) | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build MicaForEveryone.App\MicaForEveryone.App.csproj /p:Platform=x64 -c Release /p:GenerateAppxPackageOnBuild=true /p:UapAppxPackageBuildMode=${{ matrix.channel == 'Store' && 'CI' || 'SideloadOnly' }} /p:TrustedSigningEnabled=${{ inputs.release && 'true' || 'false' }} /p:TrustedSigningMetadataPath="${{ github.workspace }}\trusted-signing.json" --no-restore | |
| - name: Copy artifacts | |
| run: | | |
| $isStore = "${{ matrix.channel }}" -eq "Store" | |
| $extensions = if ($isStore) { (".msixupload") } else { (".msixbundle", ".appxsym") } | |
| $outputDir = "${{ github.workspace }}\output" | |
| $appPackagesDir = Get-ChildItem -Path . -Directory -Recurse | | |
| Where-Object { $_.Name -eq "AppPackages" } | | |
| Select-Object -First 1 | |
| New-Item -ItemType Directory -Path $outputDir -Force | Out-Null | |
| Get-ChildItem -Path $appPackagesDir -File -Recurse | | |
| Where-Object { $_.Extension -in $extensions -and $_.FullName -notmatch '\\Dependencies\\' } | | |
| ForEach-Object { | |
| Copy-Item -Path $_ -Destination $outputDir | |
| } | |
| if (-not $isStore) { | |
| $dependenciesDir = Get-ChildItem -Path $appPackagesDir -Directory -Recurse | | |
| Where-Object { $_.Name -eq "Dependencies" } | | |
| Select-Object -First 1 | |
| $dependencyOutputDir = Join-Path $outputDir "Dependencies" | |
| New-Item -ItemType Directory -Path $dependencyOutputDir -Force | Out-Null | |
| foreach ($arch in @("arm64", "x64", "x86")) { | |
| $archDirectories = Get-ChildItem -Path $dependenciesDir -Directory -Recurse | | |
| Where-Object { $_.Name -ieq $arch } | |
| foreach ($archDirectory in $archDirectories) { | |
| Get-ChildItem -Path $archDirectory -File -Filter "*.msix" | ForEach-Object { | |
| $destinationName = "{0}.{1}{2}" -f $_.BaseName, $arch, $_.Extension | |
| $destinationPath = Join-Path $dependencyOutputDir $destinationName | |
| Copy-Item -Path $_ -Destination $destinationPath -Force | |
| } | |
| } | |
| } | |
| } | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.channel == 'Store' && 'StorePackage' || 'AppInstallerPackage' }} | |
| path: ${{ github.workspace }}\output\ | |
| archive: ${{ matrix.channel != 'Store' }} |