Skip to content

Commit c987651

Browse files
committed
fix(release): simplify macOS Homebrew publishing
Keep the hub.opencsg.com installer as the primary path, make Homebrew a macOS-focused extra entrypoint from the main repo, and include release checksums in the local packaging flow. Also correct the swapped AI Apps English and Chinese labels. Made-with: Cursor
1 parent 581cef8 commit c987651

File tree

13 files changed

+232
-134
lines changed

13 files changed

+232
-134
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,15 @@ jobs:
128128
with:
129129
go-version: "1.22"
130130

131-
# Without HOMEBREW_TAP_TOKEN, publishing the tap fails with 401 and marks the job failed
132-
# even though the GitHub release assets already uploaded.
133131
- uses: goreleaser/goreleaser-action@v6
134132
with:
135133
version: latest
136-
args: release --clean${{ secrets.HOMEBREW_TAP_TOKEN == '' && ' --skip=homebrew' || '' }}
134+
args: release --clean
137135
env:
138136
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139-
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
140137

141-
# GitLab releases are not created by GoReleaser. Mirror the five platform archives
142-
# to GitLab generic packages + release links (same layout as scripts/push.sh).
138+
# GitLab releases are not created by GoReleaser. Mirror the packaged release
139+
# assets to GitLab generic packages + release links (same layout as scripts/push.sh).
143140
- name: Upload release assets to GitLab
144141
if: ${{ secrets.GITLAB_TOKEN != '' }}
145142
env:

.goreleaser.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,6 @@ archives:
3838
- README.md
3939
- LICENSE*
4040

41-
brews:
42-
- name: csghub-lite
43-
repository:
44-
owner: opencsgs
45-
name: homebrew-tap
46-
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
47-
directory: Formula
48-
homepage: "https://github.com/opencsgs/csghub-lite"
49-
description: "Lightweight tool for running LLMs locally with CSGHub platform"
50-
license: "Apache-2.0"
51-
dependencies:
52-
- name: llama.cpp
53-
type: recommended
54-
test: |
55-
system "#{bin}/csghub-lite", "--version"
56-
install: |
57-
bin.install "csghub-lite"
58-
5941
nfpms:
6042
- id: packages
6143
package_name: csghub-lite

Formula/csghub-lite.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
class CsghubLite < Formula
22
desc "Lightweight tool for running LLMs locally with CSGHub platform"
33
homepage "https://github.com/opencsgs/csghub-lite"
4-
version "0.1.0"
4+
version "0.6.3"
55
license "Apache-2.0"
66

77
on_macos do
88
on_arm do
9-
url "https://github.com/opencsgs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_darwin_arm64.tar.gz"
10-
# sha256 will be filled in by goreleaser or manually after release
9+
url "https://github.com/OpenCSGs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_darwin-arm64.tar.gz"
10+
sha256 "9d4534750197f88972672c32db9acab0361571f2fa507d0281f729a17d9bc667"
1111
end
12+
1213
on_intel do
13-
url "https://github.com/opencsgs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_darwin_amd64.tar.gz"
14+
url "https://github.com/OpenCSGs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_darwin-amd64.tar.gz"
15+
sha256 "488e4447c5005e6f2f5cd6f38f4510e6e2b7d6cdc1ec2a58c1964f55c04ee489"
1416
end
1517
end
1618

1719
on_linux do
1820
on_arm do
19-
url "https://github.com/opencsgs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_linux_arm64.tar.gz"
21+
url "https://github.com/OpenCSGs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_linux-arm64.tar.gz"
22+
sha256 "c085909632c83c0286961b87828e1332683f29ef11b5c742891bd3d9ae1934f9"
2023
end
24+
2125
on_intel do
22-
url "https://github.com/opencsgs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_linux_amd64.tar.gz"
26+
url "https://github.com/OpenCSGs/csghub-lite/releases/download/v#{version}/csghub-lite_#{version}_linux-amd64.tar.gz"
27+
sha256 "af094fdf3df3724da762294a7781e48dbc455bf3bf4e84ed2e83538778b7b67a"
2328
end
2429
end
2530

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ package: clean-dist build-all
5151
cd $${TMPDIR} && zip -q -r $(CURDIR)/dist/$(BINARY_NAME)_$(VERSION)_windows-amd64.zip *; \
5252
rm -rf $${TMPDIR}; \
5353
echo "Created dist/$(BINARY_NAME)_$(VERSION)_windows-amd64.zip"
54+
@./scripts/write-checksums.sh dist
55+
@echo "Created dist/checksums.txt"
5456

5557
release:
5658
@scripts/push.sh

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ Inspired by [Ollama](https://ollama.com), csghub-lite provides model download, l
2424
curl -fsSL https://hub.opencsg.com/csghub-lite/install.sh | sh
2525
```
2626

27+
### Optional: Homebrew (mainly macOS)
28+
29+
```bash
30+
brew tap opencsgs/csghub-lite https://github.com/OpenCSGs/csghub-lite
31+
brew install opencsgs/csghub-lite/csghub-lite
32+
```
33+
34+
Homebrew is provided as an extra install path mainly for macOS users. On Linux,
35+
prefer `curl ... | sh`, release tarballs, or native packages.
36+
2737
### Quick install (Windows PowerShell)
2838

2939
```powershell

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ csghub-lite 是一个轻量级的本地大语言模型运行工具,基于 [CSG
66

77
### 快速上手
88

9-
- [安装指南](getting-started/installation.md) — 多种安装方式:一键脚本、Homebrew、源码编译
9+
- [安装指南](getting-started/installation.md) — 多种安装方式:一键脚本、Homebrew(主要面向 macOS)、源码编译
1010
- [快速入门](getting-started/quickstart.md) — 5 分钟上手:搜索、下载、对话、启动 API
1111

1212
### CLI 命令参考
@@ -36,5 +36,5 @@ csghub-lite 是一个轻量级的本地大语言模型运行工具,基于 [CSG
3636

3737
- [配置说明](guides/configuration.md) — 配置文件、私有化部署、环境变量
3838
- [模型格式](guides/model-formats.md) — GGUF / SafeTensors 格式说明与转换
39-
- [打包与发布](guides/packaging.md) — GoReleaser、Homebrew、安装脚本
39+
- [打包与发布](guides/packaging.md) — GoReleaser、Homebrew(主要面向 macOS)、安装脚本
4040
- [架构设计](guides/architecture.md) — 项目结构与模块设计

docs/getting-started/installation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
适用于 Linux 和 macOS,自动检测系统架构,从 GitHub Releases 下载安装。
1414

1515
```bash
16-
curl -fsSL https://raw.githubusercontent.com/opencsgs/csghub-lite/main/scripts/install.sh | sh
16+
curl -fsSL https://hub.opencsg.com/csghub-lite/install.sh | sh
1717
```
1818

1919
指定版本安装:
2020

2121
```bash
22-
CSGHUB_LITE_VERSION=v0.1.0 curl -fsSL https://raw.githubusercontent.com/opencsgs/csghub-lite/main/scripts/install.sh | sh
22+
CSGHUB_LITE_VERSION=v0.1.0 curl -fsSL https://hub.opencsg.com/csghub-lite/install.sh | sh
2323
```
2424

2525
安装脚本环境变量(可选):
@@ -31,13 +31,13 @@ CSGHUB_LITE_VERSION=v0.1.0 curl -fsSL https://raw.githubusercontent.com/opencsgs
3131

3232
说明:若远程 llama.cpp 与本地 **build 号一致**,脚本会跳过重新下载;此前若因缺少 `libmtmd.so.0` 等导致 `llama-server --version` 失败,会被误判为需要升级——新版本已用 `LD_LIBRARY_PATH` 检测版本,并从压缩包 **递归** 安装所有 `.so`
3333

34-
### 方式二:Homebrew
34+
### 方式二:Homebrew(主要面向 macOS)
3535

36-
适用于 macOS 和 Linux。
36+
可选额外入口,主安装入口仍然推荐使用上面的 `curl ... | sh`Linux 仍建议优先使用安装脚本、release 压缩包或系统包管理器
3737

3838
```bash
39-
brew tap opencsgs/tap
40-
brew install csghub-lite
39+
brew tap opencsgs/csghub-lite https://github.com/OpenCSGs/csghub-lite
40+
brew install opencsgs/csghub-lite/csghub-lite
4141
```
4242

4343
### 方式三:GitHub Releases 手动下载

docs/guides/packaging.md

Lines changed: 49 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
# 打包与发布
22

3-
csghub-lite 使用 [GoReleaser](https://goreleaser.com) 进行跨平台构建和发布
3+
csghub-lite 当前以本地 `make package` + `scripts/push.sh` 手动发布为主。GoReleaser 仍然保留用于定义归档格式、生成 GitHub Release 产物,以及执行本地 snapshot 验证,但不再负责 Homebrew tap 发布
44

55
## 支持的分发形式
66

77
| 分发方式 | 平台 | 文件/命令 |
88
|---------|------|-----------|
9-
| 一键安装脚本 | Linux / macOS | `curl -fsSL .../install.sh \| sh` |
10-
| Homebrew | macOS / Linux | `brew install csghub-lite` |
9+
| 一键安装脚本 | Linux / macOS | `curl -fsSL https://hub.opencsg.com/csghub-lite/install.sh \| sh` |
10+
| Homebrew | macOS | `brew tap opencsgs/csghub-lite https://github.com/OpenCSGs/csghub-lite && brew install opencsgs/csghub-lite/csghub-lite` |
1111
| tar.gz | macOS / Linux | GitHub Releases |
1212
| zip | Windows | GitHub Releases |
1313
| deb | Debian / Ubuntu | GitHub Releases |
1414
| rpm | RHEL / CentOS / Fedora | GitHub Releases |
1515
| 源码编译 | 全平台 | `make build` |
1616

17-
## 构建
18-
19-
### 本地构建
17+
## 本地构建
2018

2119
```bash
2220
# 构建当前平台
@@ -25,133 +23,93 @@ make build
2523
# 构建全平台
2624
make build-all
2725

28-
# 二进制文件输出到 bin/ 目录
29-
ls bin/
30-
csghub-lite # 当前平台
31-
csghub-lite-darwin-arm64 # macOS Apple Silicon
32-
csghub-lite-darwin-amd64 # macOS Intel
33-
csghub-lite-linux-amd64 # Linux x86_64
34-
csghub-lite-linux-arm64 # Linux ARM64
35-
csghub-lite-windows-amd64.exe # Windows
26+
# 打包发布产物
27+
make package
3628
```
3729

38-
`make build``make build-all``make package` 都会先构建 `web` 并同步到 `internal/server/static`,确保发布二进制内嵌 Web UI。
30+
`make build``make build-all``make package` 都会先构建 `web` 并同步到 `internal/server/static`,确保发布二进制内嵌 Web UI。`make package` 还会额外生成 `dist/checksums.txt`,供 Homebrew formula 和发布校验复用。
3931

40-
### 版本号
32+
## 版本号
4133

42-
版本号通过 `git tag` 管理,自动嵌入二进制文件
34+
版本号通过 `git tag` 管理,并在构建时注入二进制
4335

4436
```bash
4537
git tag v0.1.0
4638
git push origin v0.1.0
4739
```
4840

49-
本地开发时版本号为 `dev`
50-
51-
## GoReleaser 配置
52-
53-
配置文件: `.goreleaser.yml`
54-
55-
### 核心设置
56-
57-
```yaml
58-
builds:
59-
- id: csghub-lite
60-
main: ./cmd/csghub-lite
61-
env:
62-
- CGO_ENABLED=0 # 纯 Go 编译,无 CGO 依赖
63-
goos: [linux, darwin, windows]
64-
goarch: [amd64, arm64]
65-
ldflags:
66-
- -s -w -X main.version={{.Version}}
67-
```
68-
69-
### 包格式
70-
71-
- **tar.gz**: Linux / macOS 默认
72-
- **zip**: Windows 默认
73-
- **deb / rpm**: 通过 NFPM 生成
74-
75-
### Homebrew Tap
76-
77-
GoReleaser 自动将 Homebrew formula 推送到 `opencsgs/homebrew-tap` 仓库。需要配置 `HOMEBREW_TAP_TOKEN` secret。
78-
79-
## CI/CD
80-
81-
通过 GitHub Actions 自动化,配置文件: `.github/workflows/ci.yml`
82-
83-
### 触发条件
84-
85-
- **Push / PR 到 main**: 运行测试
86-
- **Push tag `v*`**: 运行测试 + GoReleaser 发布
41+
未打 tag 的本地开发构建默认显示为 `dev`
8742

88-
### 发布流程
43+
## 推荐发布流程
8944

9045
```bash
9146
# 1. 确保测试通过
9247
make test
9348

94-
# 2. 创建版本标签
49+
# 2. 创建发布 tag
9550
git tag v0.1.0
9651

97-
# 3. 推送标签(触发 CI 自动发布)
98-
git push origin v0.1.0
99-
```
52+
# 3. 本地打包(会构建 web 并生成 dist/checksums.txt)
53+
make package
10054

101-
CI 自动执行:
55+
# 4. 更新仓库内 Homebrew formula
56+
./scripts/update-homebrew-formula.sh --tag v0.1.0
10257

103-
1. 运行所有测试
104-
2. GoReleaser 交叉编译所有平台
105-
3. 上传到 GitHub Releases
106-
4. 更新 Homebrew tap
107-
5. 生成 deb / rpm 包
58+
# 5. 上传 GitHub / GitLab release 资产
59+
./scripts/push.sh --skip-build --tag v0.1.0
60+
```
10861

109-
### GitLab 同步(CSGHub / 国内安装源)
62+
说明:
11063

111-
推送 `v*` 标签只会触发 **GitHub** 上的 GoReleaser 发布;**GitLab** 上的 Release 与 Generic Package 需要单独上传,否则 `install.sh` 在国内(CN)从 GitLab 拉取时会缺包。
64+
- `scripts/push.sh` 会将本地 `dist/` 下的发布包上传到 GitHub Release 和 GitLab Generic Package/Release。
65+
- GitLab 上传会自动从 `local/secrets.env` 读取 `GITLAB_TOKEN`(如果环境变量未设置)。
66+
- 如果你希望仓库中的 `Formula/csghub-lite.rb` 始终指向“最新正式版”,请在发布完成后提交该文件的更新。
11267

113-
**推荐(自动化)**:在 GitHub 仓库 **Settings → Secrets and variables → Actions** 中新增 `GITLAB_TOKEN`(GitLab 个人访问令牌,`api` 权限)。发布工作流在 GoReleaser 成功后会调用 `scripts/push.sh`,将五个平台压缩包同步到 `git-devops.opencsg.com` 上与本项目 `scripts/push.sh` 一致的 Generic Package 路径。未配置该 secret 时此步骤跳过,行为与以前一致。
68+
## GitLab 补发
11469

115-
**手动补发某个版本**(例如已发 GitHub 但未发 GitLab
70+
如果某个版本已经发到了 GitHub,但 GitLab 资产缺失,可以先把 release 文件拉回本地再补发
11671

11772
```bash
118-
# 从 GitHub Release 拉取 GoReleaser 产物到 dist/
11973
gh release download v0.5.10 --repo OpenCSGs/csghub-lite -D dist/
120-
121-
# 文件名改为与 install.sh / push.sh 一致(OS-ARCH 用连字符)
12274
./scripts/rename-dist-for-gitlab.sh 0.5.10
123-
124-
export GITLAB_TOKEN="glpat-..." # 或写入 local/secrets.env 后由 push.sh 自动加载
12575
./scripts/push.sh --skip-github --skip-build --skip-gitlab-git --tag v0.5.10
12676
```
12777

128-
本地从零构建再上传时,检出对应 tag 后执行 `make package`,确认产物已内嵌最新 Web UI,然后执行 `scripts/push.sh --skip-github --skip-build --tag vX.Y.Z`(会包含向 GitLab 推送 tag,除非加 `--skip-gitlab-git`)。
78+
## 安装脚本
12979

130-
### 本地测试发布
80+
主安装入口保持不变:
13181

13282
```bash
133-
# GoReleaser 本地快照(不实际发布)
134-
make release-snapshot
83+
curl -fsSL https://hub.opencsg.com/csghub-lite/install.sh | sh
84+
```
13585

136-
# 输出到 dist/ 目录
137-
ls dist/
86+
`scripts/install.sh` 会自动检测 OS 和 CPU 架构,优先从 GitHub/GitLab release 资产下载最新版本,并在需要时安装或升级 `llama-server`
87+
88+
指定版本安装:
89+
90+
```bash
91+
CSGHUB_LITE_VERSION=v0.1.0 curl -fsSL https://hub.opencsg.com/csghub-lite/install.sh | sh
13892
```
13993

140-
## 安装脚本
94+
## Homebrew Formula
95+
96+
Homebrew 现在是 repo 内维护的额外入口,主要面向 macOS。主仓库本身充当自定义 tap,不依赖独立的 `homebrew-tap` 仓库,也不需要向 Homebrew 上传二进制文件。
14197

142-
`scripts/install.sh` 提供一键安装:
98+
Linux 的正式安装文档仍以 `install.sh`、release 压缩包和 `deb/rpm` 为主。
14399

144-
- 自动检测 OS 和 CPU 架构
145-
- 从 GitHub Releases 下载最新版本
146-
- 解压并安装到 `/usr/local/bin`
147-
- 检查 `llama-server` 是否可用
100+
- Formula 文件位于 `Formula/csghub-lite.rb`
101+
- 更新脚本位于 `scripts/update-homebrew-formula.sh`
102+
- 该脚本读取 `dist/checksums.txt`,将当前 release 的 URL 和 SHA256 写回 formula
148103

149-
支持指定版本
104+
用户先把主仓库 tap 进 Homebrew,再安装对应 formula
150105

151106
```bash
152-
CSGHUB_LITE_VERSION=v0.1.0 curl -fsSL .../install.sh | sh
107+
brew tap opencsgs/csghub-lite https://github.com/OpenCSGs/csghub-lite
108+
brew install opencsgs/csghub-lite/csghub-lite
153109
```
154110

155-
## Homebrew Formula
111+
## GoReleaser 与 CI
156112

157-
独立的 Homebrew formula 位于 `Formula/csghub-lite.rb`,主要用于本地测试。正式发布由 GoReleaser 自动推送到 `opencsgs/homebrew-tap`。
113+
- `.goreleaser.yml` 继续定义 archive、checksum、nfpm 和 GitHub release 相关配置
114+
- `make release-snapshot` 可在本地验证 GoReleaser 输出
115+
- GitHub Actions 仍会在 tag 上构建 release 产物,但仓库约定的正式发布方式仍然是本地打包后手动上传

scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# csghub-lite install script
3-
# Usage: curl -fsSL https://raw.githubusercontent.com/opencsgs/csghub-lite/main/scripts/install.sh | sh
3+
# Usage: curl -fsSL https://hub.opencsg.com/csghub-lite/install.sh | sh
44
set -eu
55

66
REPO="${REPO:-OpenCSGs/csghub-lite}"

scripts/push.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ done
9090
f="dist/${BINARY_NAME}_${VERSION}_windows-amd64.zip"
9191
[ -f "$f" ] || die "Asset not found: $f"
9292
ASSETS="$ASSETS $f"
93+
f="dist/checksums.txt"
94+
[ -f "$f" ] || die "Asset not found: $f"
95+
ASSETS="$ASSETS $f"
9396

9497
info "Assets:${ASSETS}"
9598

0 commit comments

Comments
 (0)