Skip to content

Commit 9d3b307

Browse files
committed
feat: add Windows publish script and GitHub Actions CI/CD
- win/publish.ps1: self-contained publish script for local Windows builds - .github/workflows/build-windows.yml: auto-build + test + package zip on push - docs/index.html: updated download section with macOS + Windows install buttons
1 parent fd87631 commit 9d3b307

3 files changed

Lines changed: 162 additions & 16 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build Windows
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'win/**'
8+
- '.github/workflows/build-windows.yml'
9+
pull_request:
10+
paths:
11+
- 'win/**'
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
name: Build & Package (Windows)
17+
runs-on: windows-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup .NET 8
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: '8.0.x'
29+
30+
- name: Restore
31+
working-directory: win
32+
run: dotnet restore
33+
34+
- name: Build
35+
working-directory: win
36+
run: dotnet build -c Release --nologo
37+
38+
- name: Test
39+
working-directory: win
40+
run: dotnet test -c Release --nologo --no-build
41+
42+
- name: Publish (self-contained win-x64)
43+
working-directory: win
44+
run: |
45+
dotnet publish OneMenu.App/OneMenu.App.csproj `
46+
-c Release `
47+
-r win-x64 `
48+
--self-contained true `
49+
-p:PublishSingleFile=false `
50+
-p:IncludeNativeLibrariesForSelfExtract=true `
51+
--nologo `
52+
-o publish
53+
54+
- name: Package zip
55+
run: |
56+
$version = (git describe --tags --always 2>$null) -replace '/', '-'
57+
if (-not $version) { $version = "dev" }
58+
$zipName = "oneMenu-windows-$version.zip"
59+
Compress-Archive -Path win\publish\* -DestinationPath $zipName
60+
Write-Host "Package: $zipName"
61+
62+
- name: Upload zip artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: oneMenu-windows
66+
path: oneMenu-windows-*.zip
67+
retention-days: 30

‎docs/index.html‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ <h1 id="hero-title" data-i18n="heroTitle">一目了然,掌控 AI 任务</h1>
6666
汇聚到一条菜单栏。支持 macOS 和 Windows,让你在等待 AI 输出时保持对系统的全面感知。
6767
</p>
6868
<div class="hero-actions" aria-label="下载操作" data-i18n-attr="aria-label:downloadActionsAria">
69-
<a class="download-button" href="downloads/oneMenu-0.1.2.dmg" download data-i18n="heroDownload">下载 macOS 版</a>
70-
<a class="checksum-link" href="downloads/oneMenu-0.1.2.dmg.sha256" data-i18n="heroChecksum">查看 SHA-256</a>
69+
<a class="download-button" href="downloads/oneMenu-0.1.2.dmg" download>🏔️ 下载 macOS 版</a>
70+
<a class="download-button" href="https://github.com/SSDWGG/oneMenu/releases/latest" target="_blank" style="background:linear-gradient(135deg,#2672EC,#0063B1)">🪟 下载 Windows 版</a>
7171
</div>
7272
<dl class="release-strip" aria-label="版本信息" data-i18n-attr="aria-label:releaseAria">
7373
<div>
@@ -76,11 +76,11 @@ <h1 id="hero-title" data-i18n="heroTitle">一目了然,掌控 AI 任务</h1>
7676
</div>
7777
<div>
7878
<dt data-i18n="releaseFormat">格式</dt>
79-
<dd>DMG</dd>
79+
<dd>DMG / ZIP</dd>
8080
</div>
8181
<div>
82-
<dt data-i18n="releaseSize">大小</dt>
83-
<dd data-i18n="releaseSizeValue">约 1.4 MB</dd>
82+
<dt data-i18n="releaseSize">平台</dt>
83+
<dd>macOS + Windows</dd>
8484
</div>
8585
</dl>
8686
</div>
@@ -278,26 +278,26 @@ <h2 id="privacy-title" data-i18n="privacyTitle">本地解析,不上传会话
278278
<section class="section install" id="install" aria-labelledby="install-title">
279279
<div class="section-heading">
280280
<p class="eyebrow" data-i18n="installEyebrow">Install</p>
281-
<h2 id="install-title" data-i18n="installTitle">Mac 用户:下载 DMG,Windows 用户:克隆并构建。</h2>
281+
<h2 id="install-title" data-i18n="installTitle">一条菜单栏,两个平台。</h2>
282282
</div>
283283
<div class="install-grid">
284284
<article class="install-step" data-spring-card>
285285
<span>🏔️</span>
286-
<h3 data-i18n="installStepOneTitle">macOS 下载</h3>
287-
<p data-i18n="installStepOneText">获取当前版本的 DMG 安装包。</p>
288-
<a href="downloads/oneMenu-0.1.2.dmg" download data-i18n="installStepOneLink">下载 oneMenu-0.1.2.dmg</a>
286+
<h3>macOS</h3>
287+
<p>下载 DMG,拖入 Applications 即可。</p>
288+
<a href="downloads/oneMenu-0.1.2.dmg" download>下载 oneMenu-0.1.2.dmg</a>
289289
</article>
290290
<article class="install-step" data-spring-card>
291291
<span>🪟</span>
292-
<h3>Windows 构建</h3>
293-
<p>克隆仓库,使用 .NET 8 SDK 构建 Windows 客户端。</p>
294-
<a href="https://github.com/SSDWGG/oneMenu">GitHub: SSHdwgg/oneMenu</a>
295-
<code style="display:block;margin-top:8px;font-size:11px;opacity:.7">cd win && dotnet build && dotnet run --project OneMenu.App</code>
292+
<h3>Windows</h3>
293+
<p>下载 zip,解压后运行 OneMenu.App.exe。</p>
294+
<a href="https://github.com/SSDWGG/oneMenu/releases">前往 GitHub Releases 下载</a>
296295
</article>
297296
<article class="install-step" data-spring-card>
298-
<span>2</span>
299-
<h3 data-i18n="installStepTwoTitle">安装</h3>
300-
<p data-i18n="installStepTwoText">打开 DMG,把 oneMenu 拖到 Applications。</p>
297+
<span>⚙️</span>
298+
<h3>开发者构建</h3>
299+
<p>克隆仓库,使用 .NET 8 SDK 自行构建。</p>
300+
<a href="https://github.com/SSDWGG/oneMenu">GitHub: SSDWGG/oneMenu</a>
301301
</article>
302302
</div>
303303

‎win/publish.ps1‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<#
2+
.SYNOPSIS
3+
Build and package oneMenu for Windows.
4+
.DESCRIPTION
5+
- Restores NuGet packages
6+
- Builds in Release mode
7+
- Runs unit tests
8+
- Publishes as self-contained win-x64
9+
- Creates a zip package for distribution
10+
.PARAMETER OutputDir
11+
Directory for the final zip artifact. Default: .\dist
12+
.PARAMETER Version
13+
Version tag to embed. Defaults to reading from git describe.
14+
.EXAMPLE
15+
.\publish.ps1
16+
.\publish.ps1 -OutputDir ..\dist -Version 0.2.0
17+
#>
18+
19+
param(
20+
[string]$OutputDir = "$PSScriptRoot\dist",
21+
[string]$Version = ""
22+
)
23+
24+
$ErrorActionPreference = "Stop"
25+
Set-Location $PSScriptRoot
26+
27+
# Resolve version
28+
if (-not $Version) {
29+
try {
30+
$Version = git describe --tags --always 2>$null
31+
} catch {
32+
$Version = "0.2.0-dev"
33+
}
34+
}
35+
Write-Host "=== oneMenu Windows Build v$Version ===" -ForegroundColor Cyan
36+
37+
# Clean
38+
Write-Host "`n[1/4] Cleaning..." -ForegroundColor Yellow
39+
Remove-Item -Recurse -Force $OutputDir -ErrorAction SilentlyContinue
40+
dotnet clean -c Release --nologo 2>$null
41+
42+
# Restore
43+
Write-Host "`n[2/4] Restoring packages..." -ForegroundColor Yellow
44+
dotnet restore --nologo
45+
46+
# Build & Test
47+
Write-Host "`n[3/4] Building and testing..." -ForegroundColor Yellow
48+
dotnet build -c Release --nologo
49+
dotnet test -c Release --nologo --no-build
50+
51+
# Publish self-contained
52+
Write-Host "`n[4/4] Publishing self-contained win-x64..." -ForegroundColor Yellow
53+
$publishDir = "$OutputDir\publish"
54+
55+
dotnet publish OneMenu.App\OneMenu.App.csproj `
56+
-c Release `
57+
-r win-x64 `
58+
--self-contained true `
59+
-p:PublishSingleFile=false `
60+
-p:IncludeNativeLibrariesForSelfExtract=true `
61+
--nologo `
62+
-o $publishDir
63+
64+
# Package as zip
65+
Write-Host "`nPackaging..." -ForegroundColor Yellow
66+
$zipName = "oneMenu-windows-$Version.zip"
67+
$zipPath = "$OutputDir\$zipName"
68+
69+
if (Test-Path $zipPath) { Remove-Item $zipPath }
70+
Compress-Archive -Path "$publishDir\*" -DestinationPath $zipPath
71+
72+
# Report
73+
$publishSize = "{0:N1} MB" -f ((Get-ChildItem -Recurse $publishDir | Measure-Object Length -Sum).Sum / 1MB)
74+
$zipSize = "{0:N1} MB" -f ((Get-Item $zipPath).Length / 1MB)
75+
76+
Write-Host "`n=== Done ===" -ForegroundColor Green
77+
Write-Host " Publish dir : $publishDir ($publishSize)"
78+
Write-Host " Zip package : $zipPath ($zipSize)"
79+
Write-Host " Run : $publishDir\OneMenu.App.exe" -ForegroundColor Cyan

0 commit comments

Comments
 (0)