7a8a8daeca
- Replace non-existent --token-stdin with github-oidc method - Add id-token: write permission for OIDC - Remove MCP_PUBLISH_TOKEN (not needed with OIDC)
234 lines
8.4 KiB
YAML
234 lines
8.4 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version tag (e.g., v1.31.0)'
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build-macos:
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Build release binary
|
|
run: cargo build --release
|
|
|
|
- name: Package binary
|
|
run: |
|
|
mkdir -p dist/mcp-mt5-quant-macos
|
|
cp target/release/mt5-quant dist/mcp-mt5-quant-macos/
|
|
cp -r config dist/mcp-mt5-quant-macos/
|
|
cp README.md dist/mcp-mt5-quant-macos/
|
|
cp -r docs dist/mcp-mt5-quant-macos/
|
|
cd dist
|
|
tar -czf mcp-mt5-quant-macos-arm64.tar.gz mcp-mt5-quant-macos
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: macos-binary
|
|
path: dist/mcp-mt5-quant-macos-arm64.tar.gz
|
|
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Build release binary
|
|
run: cargo build --release
|
|
|
|
- name: Package binary
|
|
run: |
|
|
mkdir -p dist/mcp-mt5-quant-linux
|
|
cp target/release/mt5-quant dist/mcp-mt5-quant-linux/
|
|
cp -r config dist/mcp-mt5-quant-linux/
|
|
cp README.md dist/mcp-mt5-quant-linux/
|
|
cp -r docs dist/mcp-mt5-quant-linux/
|
|
cd dist
|
|
tar -czf mcp-mt5-quant-linux-x64.tar.gz mcp-mt5-quant-linux
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: linux-binary
|
|
path: dist/mcp-mt5-quant-linux-x64.tar.gz
|
|
|
|
release:
|
|
needs: [build-macos, build-linux]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download macOS artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: macos-binary
|
|
path: dist
|
|
|
|
- name: Download Linux artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: linux-binary
|
|
path: dist
|
|
|
|
- name: Create or Update GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.event.inputs.version || github.ref_name }}
|
|
name: ${{ github.event.inputs.version || github.ref_name }}
|
|
files: |
|
|
dist/mcp-mt5-quant-macos-arm64.tar.gz
|
|
dist/mcp-mt5-quant-linux-x64.tar.gz
|
|
draft: false
|
|
prerelease: false
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
build-mcp-package:
|
|
needs: release
|
|
runs-on: macos-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download macOS artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: macos-binary
|
|
path: dist
|
|
|
|
- name: Build MCP package
|
|
run: |
|
|
# Create MCP package structure
|
|
mkdir -p mcp-package/mcp-server/bin
|
|
|
|
# Extract binary from the tar.gz
|
|
cd dist
|
|
tar -xzf mcp-mt5-quant-macos-arm64.tar.gz
|
|
cp mcp-mt5-quant-macos/mt5-quant ../mcp-package/mcp-server/bin/
|
|
cd ..
|
|
|
|
# Copy config and docs
|
|
cp -r config mcp-package/
|
|
cp -r docs mcp-package/
|
|
cp README.md mcp-package/
|
|
cp server.json mcp-package/
|
|
|
|
# Create tar.gz
|
|
cd mcp-package
|
|
tar -czf ../mcp-mt5-quant-macos-arm64.tar.gz .
|
|
cd ..
|
|
|
|
# Calculate SHA256
|
|
shasum -a 256 mcp-mt5-quant-macos-arm64.tar.gz | awk '{print $1}' > mcp-sha256.txt
|
|
echo "MCP Package SHA256: $(cat mcp-sha256.txt)"
|
|
|
|
- name: Upload MCP package to release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.event.inputs.version || github.ref_name }}
|
|
files: |
|
|
mcp-mt5-quant-macos-arm64.tar.gz
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload MCP package artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mcp-package
|
|
path: mcp-mt5-quant-macos-arm64.tar.gz
|
|
|
|
mcp-publish:
|
|
needs: build-mcp-package
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write # Required for GitHub OIDC authentication
|
|
steps:
|
|
- name: Download MCP package
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: mcp-package
|
|
path: .
|
|
|
|
- name: Install mcp-publisher
|
|
run: |
|
|
# Download mcp-publisher from correct registry repository
|
|
curl -fsSL -o mcp-publisher.tar.gz "https://github.com/modelcontextprotocol/registry/releases/download/v1.0.0/mcp-publisher_1.0.0_linux_amd64.tar.gz" || {
|
|
echo "⚠️ Failed to download mcp-publisher - MCP publish will be skipped"
|
|
echo "Install manually: https://github.com/modelcontextprotocol/registry/releases"
|
|
exit 0
|
|
}
|
|
tar -xzf mcp-publisher.tar.gz mcp-publisher
|
|
chmod +x mcp-publisher
|
|
sudo mv mcp-publisher /usr/local/bin/
|
|
rm mcp-publisher.tar.gz
|
|
|
|
- name: Publish to MCP Registry
|
|
run: |
|
|
# Check if mcp-publisher is available
|
|
if ! command -v mcp-publisher &> /dev/null; then
|
|
echo "⚠️ mcp-publisher not found - skipping MCP publish"
|
|
echo "To publish manually:"
|
|
echo " 1. Install mcp-publisher:"
|
|
echo " curl -L \"https://github.com/modelcontextprotocol/registry/releases/download/v1.0.0/mcp-publisher_1.0.0_$(uname -s | tr '[:upper:]' '[:lower:]')_amd64.tar.gz\" | tar xz mcp-publisher"
|
|
echo " 2. Run: mcp-publisher login github"
|
|
echo " 3. Run: mcp-publisher publish"
|
|
exit 0
|
|
fi
|
|
|
|
echo "=== MCP Registry Publish ==="
|
|
# Use GitHub OIDC for authentication (no token needed)
|
|
mcp-publisher login github-oidc
|
|
|
|
# Publish the server
|
|
mcp-publisher publish
|
|
|
|
echo "✓ Published to MCP Registry"
|
|
|
|
release-info:
|
|
needs: [mcp-publish]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Display Release Commands
|
|
run: |
|
|
echo ""
|
|
echo "╔════════════════════════════════════════════════════════════════╗"
|
|
echo "║ 🎉 RELEASE COMPLETED SUCCESSFULLY! 🎉 ║"
|
|
echo "╚════════════════════════════════════════════════════════════════╝"
|
|
echo ""
|
|
echo "📦 GitHub Release: https://github.com/masdevid/mt5-quant/releases/tag/${{ github.event.inputs.version || github.ref_name }}"
|
|
echo "📦 MCP Registry: io.github.masdevid/mt5-quant"
|
|
echo ""
|
|
echo "═══════════════════════════════════════════════════════════════════"
|
|
echo " MCP CLIENT REGISTRATION COMMANDS"
|
|
echo "═══════════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
echo "▶️ CLAUDE CODE:"
|
|
echo " claude mcp add io.github.masdevid/mt5-quant -- ~/.local/bin/mt5-quant"
|
|
echo ""
|
|
echo "▶️ WINDSURF:"
|
|
echo ' echo \'{"mcpServers": {"io.github.masdevid/mt5-quant": {"command": "~/.local/bin/mt5-quant", "disabled": false, "registry": "io.github.masdevid/mt5-quant"}}}\' >> ~/.codeium/windsurf/mcp_config.json'
|
|
echo ""
|
|
echo "▶️ CURSOR / VSCODE:"
|
|
echo ' mkdir -p ~/.cursor && echo \'{"mcpServers": {"mt5-quant": {"command": "~/.local/bin/mt5-quant"}}}\' > ~/.cursor/mcp.json'
|
|
echo ""
|
|
echo "═══════════════════════════════════════════════════════════════════"
|