Skip to content

Commit 80f3cf5

Browse files
committed
Update dotnet-desktop.yml to support multiple build configurations and improve workflow steps
1 parent e7f5b17 commit 80f3cf5

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/dotnet-desktop.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
configuration: [Debug]
13+
configuration: [Debug, Release]
1414

1515
runs-on: windows-latest
1616

@@ -21,46 +21,56 @@ jobs:
2121
Wap_Project_Path: TTSBroswer.TTSBroswer/TTSBroswer.TTSBroswer.wapproj
2222

2323
steps:
24-
- name: Checkout
24+
- name: Checkout repository
2525
uses: actions/checkout@v4
2626
with:
2727
fetch-depth: 0
2828

29-
- name: Install .NET Core
29+
- name: Install .NET
3030
uses: actions/setup-dotnet@v4
3131
with:
3232
dotnet-version: 8.0.x
3333

34-
- name: Setup MSBuild.exe
34+
- name: Setup MSBuild
3535
uses: microsoft/setup-msbuild@v2
3636

37+
- name: Restore NuGet packages
38+
run: dotnet restore $env:Solution_Name
39+
40+
- name: Build solution
41+
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration
42+
env:
43+
Configuration: ${{ matrix.configuration }}
44+
3745
- name: Execute unit tests
38-
run: dotnet test $env:Test_Project_Path
46+
run: dotnet test $env:Test_Project_Path --configuration $env:Configuration --no-build --verbosity normal
3947

40-
- name: Restore the application
41-
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
48+
- name: Restore Wap project
49+
run: msbuild $env:Wap_Project_Path /t:Restore /p:Configuration=$env:Configuration
4250
env:
4351
Configuration: ${{ matrix.configuration }}
4452

4553
- name: Decode the pfx
54+
if: ${{ secrets.Base64_Encoded_Pfx != '' }}
4655
run: |
4756
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
4857
$certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
4958
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
5059
5160
- name: Create the app package
52-
run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }}
61+
run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:AppxBundlePlatforms=$env:Appx_Bundle_Platforms /p:PackageCertificateKeyFile=$env:Wap_Project_Directory\GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }}
5362
env:
5463
Appx_Bundle: Always
5564
Appx_Bundle_Platforms: x86|x64
5665
Appx_Package_Build_Mode: StoreUpload
5766
Configuration: ${{ matrix.configuration }}
5867

5968
- name: Remove the pfx
60-
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx
69+
if: ${{ secrets.Base64_Encoded_Pfx != '' }}
70+
run: Remove-Item -Path "$env:Wap_Project_Directory\GitHubActionsWorkflow.pfx" -Force
6171

6272
- name: Upload build artifacts
6373
uses: actions/upload-artifact@v4
6474
with:
6575
name: MSIX Package
66-
path: ${{ env.Wap_Project_Directory }}\AppPackages
76+
path: ${{ env.Wap_Project_Directory }}\AppPackages

0 commit comments

Comments
 (0)