feat(desktop,ci): GitHub Releases 分发 + 桌面端检查更新

让桌面端像开源项目一样用 GitHub Releases 分发,旧版用户自动获知更新:
- CD:.github/workflows/release.yml —— 打 vX.Y.Z 标签触发,macOS(universal)/
  Windows(amd64) 用 wails build 出安装包,softprops/action-gh-release 发布到
  GitHub Release(GOWORK=off,因 desktop 不在工作区)。
- 桌面端检查更新:lib/version.ts(APP_VERSION + 查 GitHub /releases/latest +
  语义版本比较 + openExternal 走 Wails BrowserOpenURL);UpdateBanner 启动时
  检查,有新版顶部横幅「前往下载」。404/限流/离线均静默不打扰。

注:未签名/公证(macOS Gatekeeper / Win SmartScreen 需后续证书);release
workflow 需真实 tag push 才能验证(GitHub 侧运行)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Blizzard
2026-06-23 16:26:02 +08:00
parent 9fc3597317
commit 8c980d2b37
4 changed files with 150 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
name: Release
# 打 vX.Y.Z 标签即触发:各平台用 wails 构建桌面端安装包 → 发布到 GitHub Release。
# 用户旧版 App 启动时查 /releases/latest,发现新版即提示下载(见 frontend/src/lib/version.ts)。
on:
push:
tags: ["v*"]
permissions:
contents: write # 创建 release + 上传产物需要
jobs:
build:
name: 构建 ${{ matrix.label }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
label: macOS (universal)
platform: darwin/universal
- os: windows-latest
label: Windows (amd64)
platform: windows/amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: 安装 wails CLI
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.12.0
- name: 构建桌面端(wails buildGOWORK=off 因 desktop 不在工作区)
working-directory: sundynix-desktop
env:
GOWORK: off
run: wails build -clean -platform ${{ matrix.platform }}
# macOS.app 是目录,打包成 zip 才能作为单文件资产分发。
- name: 打包 macOS 产物
if: runner.os == 'macOS'
working-directory: sundynix-desktop/build/bin
run: zip -r -y sundynix_desktop_macos_universal.zip sundynix_desktop.app
- name: 重命名 Windows 产物
if: runner.os == 'Windows'
working-directory: sundynix-desktop/build/bin
run: ren sundynix_desktop.exe sundynix_desktop_windows_amd64.exe
- name: 发布到 GitHub Release(按 tag 创建/追加资产)
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: false
files: |
sundynix-desktop/build/bin/sundynix_desktop_macos_universal.zip
sundynix-desktop/build/bin/sundynix_desktop_windows_amd64.exe