Files
xiaohongshu-mcp/.github/workflows/release.yml
zy 4c4b9cb47a fix: 恢复自动构建的 Release 功能,但不创建永久 tag
- 保留每次 push 到 main 时自动创建 Release
- 使用基于时间戳的命名(Build-年.月.日.时分-commit)
- 标记为预发布版本,用于测试
- 正式版本通过手动触发 tag-release.yml 发布

这样既保留了自动构建的 Release 供测试使用,又避免了 tag 膨胀问题

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-18 23:08:23 +08:00

106 lines
3.3 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:
permissions:
contents: write
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 release name
id: version
run: |
TIMESTAMP=$(date +%Y.%m.%d.%H%M)
COMMIT_SHA=$(git rev-parse --short HEAD)
RELEASE_NAME="Build-${TIMESTAMP}-${COMMIT_SHA}"
echo "release_name=${RELEASE_NAME}" >> $GITHUB_OUTPUT
echo "Generated release: ${RELEASE_NAME}"
- 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 (without permanent tag)
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.release_name }}
name: ${{ steps.version.outputs.release_name }}
draft: false
prerelease: true
body: |
## 🔧 自动构建版本
**注意:这是自动构建的预发布版本,用于测试。正式版本请等待手动发布。**
### 📦 下载说明
**主程序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
```
### 📊 构建信息
- **Commit**: ${{ github.sha }}
- **Branch**: main
- **Build Time**: ${{ steps.version.outputs.release_name }}
files: |
xiaohongshu-mcp-darwin-arm64
xiaohongshu-mcp-darwin-amd64
xiaohongshu-mcp-windows-amd64.exe
xiaohongshu-mcp-linux-amd64
xiaohongshu-login-darwin-arm64
xiaohongshu-login-darwin-amd64
xiaohongshu-login-windows-amd64.exe
xiaohongshu-login-linux-amd64