Update dotnet-desktop.yml and related files for improved configuratio… #10
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: TTSBroswer | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| configuration: [Debug, Release] | |
| runs-on: windows-latest | |
| env: | |
| Solution_Name: TTSBroswer.sln | |
| Test_Project_Path: TTSBroswer.TTSBroswer/TTSBroswer.TTSBroswer.csproj | |
| Wap_Project_Directory: TTSBroswer.TTSBroswer | |
| Wap_Project_Path: TTSBroswer.TTSBroswer/TTSBroswer.TTSBroswer.wapproj | |
| BASE64_PFX: ${{ secrets.BASE64_PFX }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Restore NuGet packages | |
| run: dotnet restore ${{ env.Solution_Name }} | |
| - name: Build solution | |
| run: msbuild ${{ env.Solution_Name }} /p:Configuration=${{ matrix.configuration }} | |
| - name: Execute unit tests | |
| run: dotnet test ${{ env.Test_Project_Path }} --configuration ${{ matrix.configuration }} --no-build --verbosity normal | |
| - name: Restore WAP project | |
| run: | | |
| msbuild "${{ env.Wap_Project_Path }}" /t:Restore /p:Configuration=${{ matrix.configuration }} | |
| - name: Decode the pfx | |
| if: env.BASE64_PFX != '' | |
| shell: pwsh | |
| run: | | |
| $pfx_cert_byte = [System.Convert]::FromBase64String("${{ env.BASE64_PFX }}") | |
| $certificatePath = Join-Path -Path "${{ env.Wap_Project_Directory }}" -ChildPath "GitHubActionsWorkflow.pfx" | |
| [System.IO.File]::WriteAllBytes($certificatePath, $pfx_cert_byte) | |
| - name: Create the app package | |
| run: | | |
| msbuild "${{ env.Wap_Project_Path }}" ` | |
| /p:Configuration=${{ matrix.configuration }} ` | |
| /p:UapAppxPackageBuildMode=StoreUpload ` | |
| /p:AppxBundle=Always ` | |
| /p:AppxBundlePlatforms="x86|x64" ` | |
| /p:PackageCertificateKeyFile="${{ env.Wap_Project_Directory }}\GitHubActionsWorkflow.pfx" ` | |
| /p:PackageCertificatePassword="${{ secrets.PFX_KEY }}" | |
| - name: Remove the pfx | |
| if: env.BASE64_PFX != '' | |
| shell: pwsh | |
| run: | | |
| $certificatePath = Join-Path -Path "${{ env.Wap_Project_Directory }}" -ChildPath "GitHubActionsWorkflow.pfx" | |
| if (Test-Path $certificatePath) { | |
| Remove-Item -Path $certificatePath -Force | |
| } | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MSIX Package | |
| path: ${{ env.Wap_Project_Directory }}\AppPackages |