-
Notifications
You must be signed in to change notification settings - Fork 8
89 lines (76 loc) · 3.38 KB
/
build-template.yml
File metadata and controls
89 lines (76 loc) · 3.38 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
name: Build Template
on:
workflow_call:
inputs:
configuration:
required: true
type: string
platform:
required: true
type: string
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .
jobs:
build:
runs-on: windows-2025-vs2026
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
# Build highlight
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install highlight dependencies
working-directory: Highlight
run: bun install
- name: Build highlight
working-directory: Highlight
run: bun run build-only
- name: Copy to project directory
run: copy Highlight\dist\index.html WinUI3Example\Monaco.html
- name: Set up vcpkg
working-directory: ${{env.VCPKG_INSTALLATION_ROOT}}
run: vcpkg integrate install
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Build Debug
if: inputs.configuration == 'Debug_CI2'
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{ inputs.configuration }} /p:Platform=${{ inputs.platform }} ${{env.SOLUTION_FILE_PATH}}
- name: Create Temporary Certificate
if: inputs.configuration == 'Release_CI2'
id: cert
shell: pwsh
run: |
$cert = New-SelfSignedCertificate -Type CodeSigningCert -Subject "CN=Peter" -KeyUsage DigitalSignature -FriendlyName "Temporary Certificate" -CertStoreLocation "Cert:\CurrentUser\My"
$password = ConvertTo-SecureString -String "123" -Force -AsPlainText
Export-PfxCertificate -Cert $cert -FilePath "${{github.workspace}}\UWPExample\UWPExample_TemporaryKey.pfx" -Password $password
echo "thumbprint=$($cert.Thumbprint)" >> $env:GITHUB_OUTPUT
- name: Build Release
if: inputs.configuration == 'Release_CI2'
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /m /p:Configuration=${{ inputs.configuration }} /p:Platform=${{ inputs.platform }} ${{env.SOLUTION_FILE_PATH}} -p:GenerateAppxPackageOnBuild=true -p:AppxPackageSigningEnabled=true -p:UapAppxPackageBuildMode=SideloadOnly -p:AppxPackagePublisher="CN=Peter" -p:PackageCertificateThumbprint="${{ steps.cert.outputs.thumbprint }}" -p:PackageCertificateKeyFile=""
- name: Copy SideloadReadme
if: github.event_name == 'push' && inputs.configuration == 'Release_CI2'
run: copy SideloadReadme.md AppPackages\SideloadReadme.md
- name: Zip Archive
if: github.event_name == 'push' && inputs.configuration == 'Release_CI2'
working-directory: ${{env.GITHUB_WORKSPACE}}
run: Compress-Archive -Path "AppPackages" -DestinationPath "WinUIEssential.Example(${{ inputs.platform }}).zip"
shell: pwsh
- name: Set tag
if: github.event_name == 'push' && inputs.configuration == 'Release_CI2'
id: set-tag
run: |
$out = Get-Date -format "yyyy.MM.dd.HH"
echo tag=$out >> $env:GITHUB_OUTPUT
- name: Release
if: github.event_name == 'push' && inputs.configuration == 'Release_CI2'
env:
tag: ${{steps.set-tag.outputs.tag}}
uses: softprops/action-gh-release@v2
with:
files: WinUIEssential.Example(${{ inputs.platform }}).zip
tag_name: ${{steps.set-tag.outputs.tag}}