修复 Linux GLIBC 依赖问题并添加压缩包发布 (#113)

* fix: 禁用 CGO 以解决 Linux 系统 GLIBC 版本依赖问题

- 在所有平台的构建命令中添加 CGO_ENABLED=0
- 生成静态链接的二进制文件,不依赖系统 GLIBC
- 解决 Ubuntu 20.04 等较旧系统无法运行的问题

* feat: 将发布文件打包成压缩包

- 添加打包步骤,将二进制文件压缩成 tar.gz (Unix) 或 zip (Windows)
- 每个压缩包包含主程序和登录工具
- 减小下载体积,方便用户使用
- 更新 Release 说明文档
This commit is contained in:
zy
2025-09-19 02:19:35 +08:00
committed by GitHub
parent 5785a545ae
commit 61dde42c25
2 changed files with 47 additions and 29 deletions

View File

@@ -22,7 +22,9 @@
"mcp__playwright__browser_tab_select", "mcp__playwright__browser_tab_select",
"Bash(gh pr merge:*)", "Bash(gh pr merge:*)",
"Bash(gh release list:*)", "Bash(gh release list:*)",
"Bash(awk:*)" "Bash(awk:*)",
"Bash(CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o test-xiaohongshu-mcp-linux-amd64 .)",
"Bash(tar:*)"
], ],
"deny": [] "deny": []
} }

View File

@@ -37,21 +37,37 @@ jobs:
- name: Build for multiple platforms - name: Build for multiple platforms
run: | run: |
# 主程序构建 # 主程序构建
# 禁用 CGO 以生成静态链接的二进制文件,避免 GLIBC 依赖问题
# macOS ARM64 (Apple Silicon) # macOS ARM64 (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o xiaohongshu-mcp-darwin-arm64 . CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o xiaohongshu-mcp-darwin-arm64 .
GOOS=darwin GOARCH=arm64 go build -o xiaohongshu-login-darwin-arm64 ./cmd/login CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o xiaohongshu-login-darwin-arm64 ./cmd/login
# macOS Intel # macOS Intel
GOOS=darwin GOARCH=amd64 go build -o xiaohongshu-mcp-darwin-amd64 . CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o xiaohongshu-mcp-darwin-amd64 .
GOOS=darwin GOARCH=amd64 go build -o xiaohongshu-login-darwin-amd64 ./cmd/login CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o xiaohongshu-login-darwin-amd64 ./cmd/login
# Windows x64 # Windows x64
GOOS=windows GOARCH=amd64 go build -o xiaohongshu-mcp-windows-amd64.exe . CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o xiaohongshu-mcp-windows-amd64.exe .
GOOS=windows GOARCH=amd64 go build -o xiaohongshu-login-windows-amd64.exe ./cmd/login CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o xiaohongshu-login-windows-amd64.exe ./cmd/login
# Linux x64 # Linux x64
GOOS=linux GOARCH=amd64 go build -o xiaohongshu-mcp-linux-amd64 . CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o xiaohongshu-mcp-linux-amd64 .
GOOS=linux GOARCH=amd64 go build -o xiaohongshu-login-linux-amd64 ./cmd/login CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o xiaohongshu-login-linux-amd64 ./cmd/login
- name: Package binaries
run: |
# 创建压缩包
# macOS ARM64
tar czf xiaohongshu-mcp-darwin-arm64.tar.gz xiaohongshu-mcp-darwin-arm64 xiaohongshu-login-darwin-arm64
# macOS Intel
tar czf xiaohongshu-mcp-darwin-amd64.tar.gz xiaohongshu-mcp-darwin-amd64 xiaohongshu-login-darwin-amd64
# Windows x64
zip xiaohongshu-mcp-windows-amd64.zip xiaohongshu-mcp-windows-amd64.exe xiaohongshu-login-windows-amd64.exe
# Linux x64
tar czf xiaohongshu-mcp-linux-amd64.tar.gz xiaohongshu-mcp-linux-amd64 xiaohongshu-login-linux-amd64
- name: Clean up old releases - name: Clean up old releases
run: | run: |
@@ -81,25 +97,29 @@ jobs:
### 📦 下载说明 ### 📦 下载说明
**主程序MCP 服务):** 选择适合您系统的压缩包下载:
- **macOS Apple Silicon**: `xiaohongshu-mcp-darwin-arm64` - **macOS Apple Silicon (M1/M2/M3)**: `xiaohongshu-mcp-darwin-arm64.tar.gz`
- **macOS Intel**: `xiaohongshu-mcp-darwin-amd64` - **macOS Intel**: `xiaohongshu-mcp-darwin-amd64.tar.gz`
- **Windows x64**: `xiaohongshu-mcp-windows-amd64.exe` - **Windows x64**: `xiaohongshu-mcp-windows-amd64.zip`
- **Linux x64**: `xiaohongshu-mcp-linux-amd64` - **Linux x64**: `xiaohongshu-mcp-linux-amd64.tar.gz`
**登录工具:** 每个压缩包包含:
- **macOS Apple Silicon**: `xiaohongshu-login-darwin-arm64` - `xiaohongshu-mcp-*`: MCP 服务主程序
- **macOS Intel**: `xiaohongshu-login-darwin-amd64` - `xiaohongshu-login-*`: 登录工具
- **Windows x64**: `xiaohongshu-login-windows-amd64.exe`
- **Linux x64**: `xiaohongshu-login-linux-amd64`
### 🔧 使用方法 ### 🔧 使用方法
```bash ```bash
# 1. 首先运行登录工具 # 1. 解压文件macOS/Linux
tar xzf xiaohongshu-mcp-darwin-arm64.tar.gz
# 或 Windows
# 解压 xiaohongshu-mcp-windows-amd64.zip
# 2. 运行登录工具
./xiaohongshu-login-darwin-arm64 ./xiaohongshu-login-darwin-arm64
# 2. 然后启动 MCP 服务 # 3. 启动 MCP 服务
./xiaohongshu-mcp-darwin-arm64 ./xiaohongshu-mcp-darwin-arm64
``` ```
@@ -109,11 +129,7 @@ jobs:
- **Branch**: main - **Branch**: main
- **Build Time**: ${{ steps.version.outputs.version }} - **Build Time**: ${{ steps.version.outputs.version }}
files: | files: |
xiaohongshu-mcp-darwin-arm64 xiaohongshu-mcp-darwin-arm64.tar.gz
xiaohongshu-mcp-darwin-amd64 xiaohongshu-mcp-darwin-amd64.tar.gz
xiaohongshu-mcp-windows-amd64.exe xiaohongshu-mcp-windows-amd64.zip
xiaohongshu-mcp-linux-amd64 xiaohongshu-mcp-linux-amd64.tar.gz
xiaohongshu-login-darwin-arm64
xiaohongshu-login-darwin-amd64
xiaohongshu-login-windows-amd64.exe
xiaohongshu-login-linux-amd64