-
Notifications
You must be signed in to change notification settings - Fork 21
77 lines (65 loc) · 2.5 KB
/
main_build-winui.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: WinUI3
on:
workflow_dispatch:
push:
branches:
- main
- "winui/*"
paths:
- 'src/WinUI/**/*'
- '.github/workflows/main_build-winui.yml'
env:
SOLUTION_NAME: "src/WinUI/MyDemo.sln"
NUGETCONFIG_PATH: "src/NuGet.Config"
PFX_FILENAME: "MyCodeSignCert.pfx"
TELERIK_USERNAME: ${{secrets.MyTelerikAccountUsername}} # used by the NuGet.Config file
TELERIK_PASSWORD: ${{secrets.MyTelerikAccountPassword}} # used by the NuGet.Config file
jobs:
build-windows:
strategy:
matrix:
configuration: [Release]
platform: [x86, x64]
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Restore NuGet packages
shell: pwsh
run: dotnet restore ${{env.SOLUTION_NAME}} --configfile ${{env.NUGETCONFIG_PATH}}
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore RIDs
run: msbuild ${{env.SOLUTION_NAME}} /t:Restore /p:Configuration=${{env.CONFIGURATION}}
env:
CONFIGURATION: ${{matrix.configuration}}
- name: Decode and save the pfx
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{secrets.BASE64_ENCODED_PFX}}")
$certificatePath = "${{env.PFX_FILENAME}}"
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
- name: Build and Create MSIX
run: msbuild ${{env.SOLUTION_NAME}} /p:Configuration=${{env.CONFIGURATION}} /p:Platform=${{env.PLATFORM}} /p:UapAppxPackageBuildMode=${{env.APPX_PACKAGE_BUILD_MODE}} /p:AppxBundle=${{env.APPX_BUNDLE}} /p:PackageCertificateKeyFile="${{env.PFX_FILENAME}}" /p:PackageCertificatePassword=${{secrets.PFX_PRIVATE_KEY}} /p:AppxPackageDir="${{env.APPX_PACKAGE_DIR}}" /p:GenerateAppxPackageOnBuild=${{env.GENERATE_MSIX}}
env:
GENERATE_MSIX: true
APPX_BUNDLE: Never
APPX_PACKAGE_BUILD_MODE: SideloadOnly
APPX_PACKAGE_DIR: Packages\
CONFIGURATION: ${{matrix.configuration}}
PLATFORM: ${{matrix.platform}}
# Delete the pfx file
- name: Remove the pfx
run: Remove-Item -path ${{env.PFX_FILENAME}}
# Upload the MSIX package
# - name: Upload MSIX package
# uses: actions/upload-artifact@v3
# with:
# name: MSIX Package
# path: ${{env.SOLUTION_NAME}}\\Packages