- 修改 release.yml 为仅构建不打 tag,构建产物保存为 artifacts - 新增 tag-release.yml 用于手动触发发布和打 tag - 删除所有历史自动生成的 tags - 采用更合理的版本管理策略,避免版本号膨胀 现在的工作流: 1. push to main 时自动构建(不打 tag) 2. 需要发布时手动触发 Tag and Release workflow 3. 手动输入语义化版本号(如 v1.0.0)和发布说明 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- '**.go'
|
|
- 'go.mod'
|
|
- 'go.sum'
|
|
|
|
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: Display build info
|
|
run: |
|
|
echo "Building commit: $(git rev-parse --short HEAD)"
|
|
echo "Build time: $(date +%Y.%m.%d.%H%M)"
|
|
|
|
- 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: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: binaries-${{ github.sha }}
|
|
path: |
|
|
xiaohongshu-mcp-*
|
|
xiaohongshu-login-*
|
|
retention-days: 7 |