Skip to content

Commit 2c0dd8f

Browse files
committed
ci: upgrade to dotnet 8
1 parent 6f9c84a commit 2c0dd8f

File tree

1 file changed

+64
-11
lines changed

1 file changed

+64
-11
lines changed

.github/workflows/dotnet-core.yml

+64-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,74 @@
1+
12
name: .NET Core
23

34
on: [push]
45

56
jobs:
7+
68
build:
79

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.
922

1023
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
1472
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

Comments
 (0)