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