Files
xiaohongshu-mcp/.github/workflows/release.yml
zy f12165130e feat: 添加登录工具的多平台构建支持
- GitHub Actions 现在也会构建登录工具的二进制文件
- 支持 4 个平台:macOS ARM64/Intel, Windows x64, Linux x64
- 更新 Release 说明,包含登录工具下载链接
- 更新 README 文档,提供完整的二进制使用流程
- 用户现在可以完全无需 Go 环境使用项目

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 01:49:01 +08:00

180 lines
6.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Build and Release
on:
push:
branches: [ main ]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'
- name: Generate version
id: version
run: |
TIMESTAMP=$(date +%Y.%m.%d.%H%M)
COMMIT_SHA=$(git rev-parse --short HEAD)
VERSION="v${TIMESTAMP}-${COMMIT_SHA}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Generated version: ${VERSION}"
- name: Build for multiple platforms
run: |
# 主程序构建
# macOS ARM64 (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o xiaohongshu-mcp-darwin-arm64 .
GOOS=darwin GOARCH=arm64 go build -o xiaohongshu-login-darwin-arm64 ./cmd/login
# macOS Intel
GOOS=darwin GOARCH=amd64 go build -o xiaohongshu-mcp-darwin-amd64 .
GOOS=darwin GOARCH=amd64 go build -o xiaohongshu-login-darwin-amd64 ./cmd/login
# Windows x64
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
# Linux x64
GOOS=linux GOARCH=amd64 go build -o xiaohongshu-mcp-linux-amd64 .
GOOS=linux GOARCH=amd64 go build -o xiaohongshu-login-linux-amd64 ./cmd/login
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
body: |
## 🚀 新版本发布
**注意事项:**
- 首次运行时会自动下载无头浏览器(约 150MB请确保网络连接正常
- 后续运行无需重复下载浏览器
**下载说明:**
**主程序MCP 服务):**
- **macOS Apple Silicon**: `xiaohongshu-mcp-darwin-arm64`
- **macOS Intel**: `xiaohongshu-mcp-darwin-amd64`
- **Windows x64**: `xiaohongshu-mcp-windows-amd64.exe`
- **Linux x64**: `xiaohongshu-mcp-linux-amd64`
**登录工具:**
- **macOS Apple Silicon**: `xiaohongshu-login-darwin-arm64`
- **macOS Intel**: `xiaohongshu-login-darwin-amd64`
- **Windows x64**: `xiaohongshu-login-windows-amd64.exe`
- **Linux x64**: `xiaohongshu-login-linux-amd64`
**使用方法:**
```bash
# 1. 首先运行登录工具
./xiaohongshu-login-darwin-arm64
# 2. 然后启动 MCP 服务
./xiaohongshu-mcp-darwin-arm64
# 或指定参数
./xiaohongshu-mcp-darwin-arm64 -headless=false
```
**构建信息:**
- Commit: ${{ github.sha }}
- Go Version: 1.24
- name: Upload macOS ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-mcp-darwin-arm64
asset_name: xiaohongshu-mcp-darwin-arm64
asset_content_type: application/octet-stream
- name: Upload macOS Intel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-mcp-darwin-amd64
asset_name: xiaohongshu-mcp-darwin-amd64
asset_content_type: application/octet-stream
- name: Upload Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-mcp-windows-amd64.exe
asset_name: xiaohongshu-mcp-windows-amd64.exe
asset_content_type: application/octet-stream
- name: Upload Linux x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-mcp-linux-amd64
asset_name: xiaohongshu-mcp-linux-amd64
asset_content_type: application/octet-stream
# 登录工具上传
- name: Upload Login Tool - macOS ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-login-darwin-arm64
asset_name: xiaohongshu-login-darwin-arm64
asset_content_type: application/octet-stream
- name: Upload Login Tool - macOS Intel
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-login-darwin-amd64
asset_name: xiaohongshu-login-darwin-amd64
asset_content_type: application/octet-stream
- name: Upload Login Tool - Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-login-windows-amd64.exe
asset_name: xiaohongshu-login-windows-amd64.exe
asset_content_type: application/octet-stream
- name: Upload Login Tool - Linux x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./xiaohongshu-login-linux-amd64
asset_name: xiaohongshu-login-linux-amd64
asset_content_type: application/octet-stream