Skip to content

Commit eddc53c

Browse files
committed
feat: appx 打包
1 parent cbebb41 commit eddc53c

137 files changed

Lines changed: 321 additions & 6 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: CI
33
on:
44
push:
55
branches: [main]
6-
tags: ["v*"]
76
pull_request:
87
branches: [main]
8+
workflow_dispatch:
99

1010
jobs:
1111
check-frontend:
@@ -36,6 +36,12 @@ jobs:
3636
working-directory: ChuChartManager/Front
3737
run: pnpm build
3838

39+
- name: Upload wwwroot
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: wwwroot
43+
path: ChuChartManager/wwwroot
44+
3945
check-backend:
4046
name: Check Backend
4147
runs-on: windows-latest
@@ -53,7 +59,7 @@ jobs:
5359
run: dotnet build ChuChartManager/ChuChartManager.csproj -c Release
5460

5561
build:
56-
name: Build
62+
name: Build (zip)
5763
runs-on: windows-latest
5864
needs: [check-frontend, check-backend]
5965
steps:
@@ -81,7 +87,7 @@ jobs:
8187
pnpm build
8288
8389
- name: Publish
84-
run: dotnet publish ChuChartManager/ChuChartManager.csproj -c Release -r win-x64 --self-contained -o publish /p:PublishSingleFile=false
90+
run: dotnet publish ChuChartManager/ChuChartManager.csproj -c Release -r win-x64 --self-contained -o publish /p:PublishSingleFile=false /p:ErrorOnDuplicatePublishOutputFiles=false
8591

8692
- name: Package
8793
shell: pwsh
@@ -93,6 +99,35 @@ jobs:
9399
name: ChuChartManager-win-x64
94100
path: ChuChartManager-win-x64.zip
95101

102+
build-canary-appx:
103+
name: Build Canary Appx
104+
runs-on: self-hosted
105+
needs: [check-frontend]
106+
steps:
107+
- run: git config --global core.longPaths true
108+
109+
- uses: actions/checkout@v4
110+
with:
111+
fetch-depth: 0
112+
submodules: recursive
113+
114+
- name: Download wwwroot
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: wwwroot
118+
path: ChuChartManager/wwwroot
119+
120+
- name: Build Appx
121+
shell: pwsh
122+
# self-hosted runner 已配 .NET SDK / Windows SDK / D:\Sign\signcode.cmd
123+
run: .\Packaging\Build.ps1 -Mode Canary
124+
125+
- name: Upload Appx
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: ChuChartManager-Canary-Appx
129+
path: Packaging/ChuChartManager_Canary_*.appx
130+
96131
release:
97132
name: Release
98133
if: startsWith(github.ref, 'refs/tags/v')

ChuChartManager.CLI/Commands/DebugCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ public override int Execute(CommandContext context)
99
Log.EnableConsoleOutput();
1010
Log.Info("以 debug 模式启动");
1111

12+
// WebView2 (COM) 要求 STA 线程;CLI 的 async 入口默认在 MTA 中运行,
13+
// 主项目 csproj 排除了 WPF App.xaml.cs,直接调用 Program.Main() 走 WinForms 入口
1214
Exception? exception = null;
1315
var thread = new Thread(() =>
1416
{
1517
try
1618
{
17-
var app = new App();
18-
app.InitializeComponent();
19-
app.Run();
19+
Program.Main();
2020
}
2121
catch (Exception e)
2222
{

Packaging/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.pri
2+
*.appx
3+
*.msix
4+
*.pfx
5+
*.cer
6+
Pack/

Packaging/AppxManifest.xml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
3+
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
4+
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
5+
xmlns:win32dependencies="http://schemas.microsoft.com/appx/manifest/externaldependencies"
6+
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
7+
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
8+
IgnorableNamespaces="win32dependencies">
9+
<!-- Identity 中 Name/Publisher 为占位符,发布到微软商店前由实际值替换 -->
10+
<Identity Name="PLACEHOLDER.ChuChartManager"
11+
Publisher="CN=PLACEHOLDER-MS-STORE"
12+
Version="0.1.0.0"
13+
ProcessorArchitecture="x64" />
14+
<Properties>
15+
<DisplayName>ChuChartManager</DisplayName>
16+
<PublisherDisplayName>MuNET</PublisherDisplayName>
17+
<Logo>StoreLogo.png</Logo>
18+
</Properties>
19+
<Dependencies>
20+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0"
21+
MaxVersionTested="10.0.22621.0" />
22+
<win32dependencies:ExternalDependency Name="Microsoft.WebView2"
23+
Publisher="CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
24+
MinVersion="100.0.1185.39" Optional="true" />
25+
</Dependencies>
26+
<Resources>
27+
<Resource Language="zh-cn" />
28+
<Resource Language="zh-tw" />
29+
<Resource Language="en" />
30+
<Resource Language="ja" />
31+
</Resources>
32+
<Applications>
33+
<Application Id="App" Executable="ChuChartManager.exe"
34+
EntryPoint="Windows.FullTrustApplication">
35+
<uap:VisualElements DisplayName="ChuChartManager" Description="ChuChartManager"
36+
BackgroundColor="transparent" Square150x150Logo="Square150x150Logo.png"
37+
Square44x44Logo="Square44x44Logo.png">
38+
<uap:DefaultTile Wide310x150Logo="Wide310x150Logo.png" ShortName="ChuChartManager"
39+
Square310x310Logo="LargeTile.png" Square71x71Logo="SmallTile.png" />
40+
<uap:SplashScreen Image="SplashScreen.png" />
41+
</uap:VisualElements>
42+
</Application>
43+
44+
<Application Id="CliTool"
45+
Executable="ChuChartManager.CLI.exe"
46+
EntryPoint="Windows.FullTrustApplication">
47+
<uap:VisualElements
48+
AppListEntry="none"
49+
DisplayName="ChuChartManager CLI"
50+
Description="ChuChartManager Command line tool"
51+
BackgroundColor="transparent"
52+
Square150x150Logo="Square150x150Logo.png"
53+
Square44x44Logo="Square44x44Logo.png" />
54+
<Extensions>
55+
<uap3:Extension Category="windows.appExecutionAlias">
56+
<uap3:AppExecutionAlias>
57+
<desktop:ExecutionAlias Alias="ccm.exe" />
58+
</uap3:AppExecutionAlias>
59+
</uap3:Extension>
60+
</Extensions>
61+
</Application>
62+
</Applications>
63+
<Capabilities>
64+
<rescap:Capability Name="runFullTrust" />
65+
</Capabilities>
66+
</Package>
20.6 KB
20.6 KB
20.6 KB
27.8 KB
27.8 KB
27.8 KB

0 commit comments

Comments
 (0)