Initial Commit #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Trigger on version tags like v1.0.0, v2.1.3, etc. | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build Binaries | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| # Linux builds | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| binary_suffix: '' | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: arm64 | |
| binary_suffix: '' | |
| # macOS builds | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: amd64 | |
| binary_suffix: '' | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: arm64 | |
| binary_suffix: '' | |
| # Windows builds | |
| - os: ubuntu-latest | |
| goos: windows | |
| goarch: amd64 | |
| binary_suffix: '.exe' | |
| - os: ubuntu-latest | |
| goos: windows | |
| goarch: arm64 | |
| binary_suffix: '.exe' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Get version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| BINARY_NAME="mcp-code-api-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.binary_suffix }}" | |
| go build -v -ldflags="-s -w -X 'main.Version=${{ steps.get_version.outputs.VERSION }}' -X 'main.Commit=${{ github.sha }}' -X 'main.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)'" -o "$BINARY_NAME" . | |
| # Create checksum | |
| if [ "${{ matrix.goos }}" = "windows" ]; then | |
| sha256sum "$BINARY_NAME" > "$BINARY_NAME.sha256" | |
| else | |
| shasum -a 256 "$BINARY_NAME" > "$BINARY_NAME.sha256" | |
| fi | |
| ls -lh "$BINARY_NAME" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mcp-code-api-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: | | |
| mcp-code-api-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.binary_suffix }} | |
| mcp-code-api-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.binary_suffix }}.sha256 | |
| retention-days: 7 | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| echo "VERSION_NUM=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| find ./artifacts -type f -exec mv {} ./release/ \; | |
| ls -lh ./release/ | |
| # Create a combined checksums file | |
| cd release | |
| cat *.sha256 > SHA256SUMS.txt | |
| cd .. | |
| - name: Generate release notes | |
| id: generate_notes | |
| run: | | |
| cat > release_notes.md << 'EOF' | |
| ## MCP Code API ${{ steps.get_version.outputs.VERSION }} | |
| ### 📦 Installation | |
| Download the binary for your platform and architecture: | |
| **Linux:** | |
| ```bash | |
| # AMD64 | |
| curl -L https://github.com/cecil-the-coder/mcp-code-api/releases/download/${{ steps.get_version.outputs.VERSION }}/mcp-code-api-linux-amd64 -o mcp-code-api | |
| chmod +x mcp-code-api | |
| sudo mv mcp-code-api /usr/local/bin/ | |
| # ARM64 | |
| curl -L https://github.com/cecil-the-coder/mcp-code-api/releases/download/${{ steps.get_version.outputs.VERSION }}/mcp-code-api-linux-arm64 -o mcp-code-api | |
| chmod +x mcp-code-api | |
| sudo mv mcp-code-api /usr/local/bin/ | |
| ``` | |
| **macOS:** | |
| ```bash | |
| # Intel (AMD64) | |
| curl -L https://github.com/cecil-the-coder/mcp-code-api/releases/download/${{ steps.get_version.outputs.VERSION }}/mcp-code-api-darwin-amd64 -o mcp-code-api | |
| chmod +x mcp-code-api | |
| sudo mv mcp-code-api /usr/local/bin/ | |
| # Apple Silicon (ARM64) | |
| curl -L https://github.com/cecil-the-coder/mcp-code-api/releases/download/${{ steps.get_version.outputs.VERSION }}/mcp-code-api-darwin-arm64 -o mcp-code-api | |
| chmod +x mcp-code-api | |
| sudo mv mcp-code-api /usr/local/bin/ | |
| ``` | |
| **Windows:** | |
| ```powershell | |
| # AMD64 | |
| Invoke-WebRequest -Uri "https://github.com/cecil-the-coder/mcp-code-api/releases/download/${{ steps.get_version.outputs.VERSION }}/mcp-code-api-windows-amd64.exe" -OutFile "mcp-code-api.exe" | |
| # ARM64 | |
| Invoke-WebRequest -Uri "https://github.com/cecil-the-coder/mcp-code-api/releases/download/${{ steps.get_version.outputs.VERSION }}/mcp-code-api-windows-arm64.exe" -OutFile "mcp-code-api.exe" | |
| ``` | |
| ### ✅ Verify Installation | |
| ```bash | |
| mcp-code-api --version | |
| ``` | |
| ### 🔒 Verify Checksums | |
| Download `SHA256SUMS.txt` and verify: | |
| ```bash | |
| # Linux/macOS | |
| sha256sum -c SHA256SUMS.txt | |
| # Or verify individual file | |
| sha256sum mcp-code-api-linux-amd64 | |
| cat mcp-code-api-linux-amd64.sha256 | |
| ``` | |
| ### 📋 Supported Platforms | |
| - **Linux**: AMD64, ARM64 | |
| - **macOS**: AMD64 (Intel), ARM64 (Apple Silicon) | |
| - **Windows**: AMD64, ARM64 | |
| ### 🚀 Quick Start | |
| ```bash | |
| # Run configuration wizard | |
| mcp-code-api config | |
| # Start the server | |
| mcp-code-api server | |
| ``` | |
| For detailed documentation, see the [README](https://github.com/cecil-the-coder/mcp-code-api#readme). | |
| EOF | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: Release ${{ steps.get_version.outputs.VERSION }} | |
| body_path: release_notes.md | |
| files: | | |
| release/* | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Release Summary | |
| run: | | |
| echo "## 🎉 Release ${{ steps.get_version.outputs.VERSION }} Created!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 📦 Binaries Built:" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| ls -lh release/ | grep -v "^total" | awk '{print "- " $9 " (" $5 ")"}' >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 🔗 Download:" >> $GITHUB_STEP_SUMMARY | |
| echo "https://github.com/cecil-the-coder/mcp-code-api/releases/tag/${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY |