1
0

feat: 扩展发布打包支持多组件多架构多格式产物

- 新增 web 组件独立发布为 nex-web_<version>.tar.gz
- server 新增 arm64 架构、macOS universal、Windows arm64 产物
- desktop 新增 arm64 架构支持(Linux/Windows)
- Linux desktop 新增 AppImage、deb、rpm 安装包格式
- macOS desktop 新增 unsigned DMG 安装包
- 统一发布资产命名为 {component}_{version}_{platform}_{arch}.{ext}
- 新增 SHA256SUMS 校验和清单覆盖全部发布资产
- versionctl 新增 asset-name CLI 支持按参数生成资产文件名
- Makefile release target 重构为组件/平台/架构参数化
- GitHub Actions release workflow 扩展多组件多架构构建矩阵
- 同步更新 openspec 主规范(desktop-app/release-pipeline/workspace-command-flows)
This commit is contained in:
2026-05-05 12:36:33 +08:00
parent 6de7a2d2e1
commit c9c3a84b33
13 changed files with 806 additions and 208 deletions

View File

@@ -263,44 +263,86 @@ func ReadEnvVar(content, key string) (string, bool) {
return "", false
}
func ServerAssetName(version, goos, arch string) (string, error) {
func ReleaseAssetName(version, component, platform, arch, format string) (string, error) {
if _, err := Parse(version); err != nil {
return "", err
}
switch goos {
case "linux", "windows", "darwin":
switch component {
case "server":
return serverAssetName(version, platform, arch, format)
case "web":
return webAssetName(version, platform, arch, format)
case "desktop":
return desktopAssetName(version, platform, arch, format)
default:
return "", fmt.Errorf("不支持的 server 平台 %q", goos)
return "", fmt.Errorf("不支持的资产组件 %q", component)
}
if arch == "" {
return "", errors.New("server 资产命名缺少架构")
}
ext := ".tar.gz"
if goos == "windows" {
ext = ".zip"
}
return fmt.Sprintf("nex-server_%s_%s_%s%s", version, goos, arch, ext), nil
}
func DesktopAssetName(version, platform string) (string, error) {
if _, err := Parse(version); err != nil {
return "", err
func serverAssetName(version, platform, arch, format string) (string, error) {
if !validCombination(platform, arch, format, []releaseAssetTarget{
{platform: "linux", arch: "amd64", format: "tar.gz"},
{platform: "linux", arch: "arm64", format: "tar.gz"},
{platform: "macos", arch: "amd64", format: "tar.gz"},
{platform: "macos", arch: "arm64", format: "tar.gz"},
{platform: "macos", arch: "universal", format: "tar.gz"},
{platform: "windows", arch: "amd64", format: "zip"},
{platform: "windows", arch: "arm64", format: "zip"},
}) {
return "", fmt.Errorf("不支持的 server 资产目标 %s/%s/%s", platform, arch, format)
}
switch platform {
case "linux":
return fmt.Sprintf("Nex_%s_linux_amd64.tar.gz", version), nil
case "windows":
return fmt.Sprintf("Nex_%s_windows_amd64.zip", version), nil
case "macos":
return fmt.Sprintf("Nex_%s_macOS_universal.zip", version), nil
default:
return "", fmt.Errorf("不支持的 desktop 平台 %q", platform)
return fmt.Sprintf("nex-server_%s_%s_%s.%s", version, platform, arch, format), nil
}
func webAssetName(version, platform, arch, format string) (string, error) {
if platform != "" || arch != "" {
return "", errors.New("web 资产命名不支持平台或架构参数")
}
if format != "tar.gz" {
return "", fmt.Errorf("不支持的 web 资产格式 %q", format)
}
return fmt.Sprintf("nex-web_%s.tar.gz", version), nil
}
func desktopAssetName(version, platform, arch, format string) (string, error) {
if !validCombination(platform, arch, format, []releaseAssetTarget{
{platform: "linux", arch: "amd64", format: "tar.gz"},
{platform: "linux", arch: "amd64", format: "AppImage"},
{platform: "linux", arch: "amd64", format: "deb"},
{platform: "linux", arch: "amd64", format: "rpm"},
{platform: "linux", arch: "arm64", format: "tar.gz"},
{platform: "linux", arch: "arm64", format: "AppImage"},
{platform: "linux", arch: "arm64", format: "deb"},
{platform: "linux", arch: "arm64", format: "rpm"},
{platform: "macos", arch: "universal", format: "zip"},
{platform: "macos", arch: "universal", format: "dmg"},
{platform: "windows", arch: "amd64", format: "zip"},
{platform: "windows", arch: "arm64", format: "zip"},
}) {
return "", fmt.Errorf("不支持的 desktop 资产目标 %s/%s/%s", platform, arch, format)
}
return fmt.Sprintf("nex-desktop_%s_%s_%s.%s", version, platform, arch, format), nil
}
type releaseAssetTarget struct {
platform string
arch string
format string
}
func validCombination(platform, arch, format string, targets []releaseAssetTarget) bool {
for _, target := range targets {
if target.platform == platform && target.arch == arch && target.format == format {
return true
}
}
return false
}
func DesktopInfoPlist(version, minMacOSVersion string) (string, error) {