1
+
1
2
name : .NET Core
2
3
3
4
on : [push]
4
5
5
6
jobs :
7
+
6
8
build :
7
9
8
- runs-on : ubuntu-latest
10
+ strategy :
11
+ matrix :
12
+ configuration : [Debug, Release]
13
+
14
+ runs-on : windows-latest # For a list of available runner types, refer to
15
+ # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
16
+
17
+ env :
18
+ Solution_Name : your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln.
19
+ Test_Project_Path : your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.
20
+ Wap_Project_Directory : your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package.
21
+ Wap_Project_Path : your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj.
9
22
10
23
steps :
11
- - uses : actions/checkout@v2
12
- - name : Setup .NET
13
- uses : actions/setup-dotnet@v1
24
+ - name : Checkout
25
+ uses : actions/checkout@v4
26
+ with :
27
+ fetch-depth : 0
28
+
29
+ # Install the .NET Core workload
30
+ - name : Install .NET Core
31
+ uses : actions/setup-dotnet@v4
32
+ with :
33
+ dotnet-version : 8.0.x
34
+
35
+ # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
36
+ - name : Setup MSBuild.exe
37
+ uses : microsoft/setup-msbuild@v2
38
+
39
+ # Execute all unit tests in the solution
40
+ - name : Execute unit tests
41
+ run : dotnet test
42
+
43
+ # Restore the application to populate the obj folder with RuntimeIdentifiers
44
+ - name : Restore the application
45
+ run : msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
46
+ env :
47
+ Configuration : ${{ matrix.configuration }}
48
+
49
+ # Decode the base 64 encoded pfx and save the Signing_Certificate
50
+ - name : Decode the pfx
51
+ run : |
52
+ $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
53
+ $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
54
+ [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
55
+
56
+ # Create the app package by building and packaging the Windows Application Packaging project
57
+ - name : Create the app package
58
+ 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 }}
59
+ env :
60
+ Appx_Bundle : Always
61
+ Appx_Bundle_Platforms : x86|x64
62
+ Appx_Package_Build_Mode : StoreUpload
63
+ Configuration : ${{ matrix.configuration }}
64
+
65
+ # Remove the pfx
66
+ - name : Remove the pfx
67
+ run : Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx
68
+
69
+ # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
70
+ - name : Upload build artifacts
71
+ uses : actions/upload-artifact@v3
14
72
with :
15
- dotnet-version : 5.0.x
16
- - name : Restore dependencies
17
- run : dotnet restore
18
- - name : Build
19
- run : dotnet build --configuration Release --no-restore
20
- - name : Test
21
- run : dotnet test --no-restore --verbosity normal
73
+ name : MSIX Package
74
+ path : ${{ env.Wap_Project_Directory }}\AppPackages
0 commit comments