ci: add release automation scripts and workflows

- scripts/release.sh: one-command local release (bump, changelog, tag, push)
- .github/workflows/release.yml: fix SHA256 auto-commit back to master,
  dynamic mcp-publisher version detection, cargo cache, security hardening
- .claude/commands/release.md: /release slash command
- .windsurf/workflows/release.md: streamlined to use release.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Devid HW
2026-04-22 06:15:38 +07:00
co-authored by Claude Sonnet 4.6
parent ec2a22ed30
commit 20a2d3d6e4
4 changed files with 604 additions and 252 deletions
+70 -166
View File
@@ -1,209 +1,113 @@
---
description: Release workflow - bump version, build, and publish MCP server
description: Release workflow bump version, build, tag, push, publish MCP
tags: [release, publish, workflow]
---
# MT5-Quant Release Workflow
Steps to release a new version of the MCP server.
One-command release: `bash scripts/release.sh [patch|minor|major|X.Y.Z]`
## 1. Pre-Release Checklist
---
- [ ] All features implemented and tested
- [ ] Documentation updated (README.md, MCP_TOOLS.md)
- [ ] Tool count verified: `grep -r "pub fn tool_" src/tools/definitions/ | wc -l`
- [ ] Version bumped in Cargo.toml
- [ ] Build passes: `cargo build --release`
## 0. Pre-release checklist
## 2. Update Documentation
- [ ] Features implemented and tested
- [ ] Docs updated (README.md, docs/MCP_TOOLS.md) with correct tool count
- [ ] `cargo check` passes
Check tool count:
// turbo
```bash
grep -r "pub fn tool_" src/tools/definitions/ | wc -l
```
Update these files with correct tool counts:
- `README.md` - header and "MCP Tools (N)" section
- `docs/MCP_TOOLS.md` - "documents X of Y total tools" line
---
## 3. Bump Version
Edit `Cargo.toml` and update the version:
```toml
version = "X.Y.Z"
```
## 4. Build Release
## 1. Run the release script
// turbo
```bash
bash scripts/build-release.sh
bash scripts/release.sh patch
```
This creates: `dist/mcp-mt5-quant-{platform}.tar.gz`
Accepts: `patch` · `minor` · `major` · `1.32.0` · `v1.32.0`
Calculate SHA256 for server.json:
```bash
shasum -a 256 dist/mcp-mt5-quant-macos-arm64.tar.gz
```
The script handles:
- Version bump in `Cargo.toml`
- `server.json` version + download URL update
- `CHANGELOG.md` entry generation from git log
- `cargo check` verification
- Release commit + annotated git tag
- `git push` → triggers GitHub Actions
## 5. Update MCP Server Configuration
---
Update both `server.json` files with:
- New version
- New SHA256 hash from step 4
- Updated download URL
- Tool count in description
Files to update:
- `server.json`
- `mcp-package/server.json`
Then copy the release package:
```bash
cp dist/mcp-mt5-quant-macos-arm64.tar.gz mcp-package/
```
## 6. Create Git Tag & Commit
```bash
git add .
git commit -m "Release vX.Y.Z - brief description"
git tag vX.Y.Z
git push origin vX.Y.Z
```
## 7. Create GitHub Release (Manual)
1. Go to GitHub → Releases → Draft new release
2. Choose tag: `vX.Y.Z`
3. Release title: `vX.Y.Z`
4. Attach binary: `dist/mcp-mt5-quant-macos-arm64.tar.gz`
5. Publish release
## 8. Install Binary to System Path
Install the binary to a single location for all MCP clients:
```bash
# Create local bin if needed
mkdir -p ~/.local/bin
# Install binary
cp target/release/mt5-quant ~/.local/bin/
# Or system-wide (requires sudo)
# sudo cp target/release/mt5-quant /usr/local/bin/
```
**Installation Path:** `~/.local/bin/mt5-quant` (single location for all clients)
## 9. MCP Registration
Use the installed binary path (not project directory):
### Claude Code
```bash
claude mcp add mt5-quant -- ~/.local/bin/mt5-quant
```
### Windsurf
Edit `~/.codeium/windsurf/mcp_config.json`:
```json
{
"mcpServers": {
"mt5-quant": {
"command": "~/.local/bin/mt5-quant"
}
}
}
```
### VS Code / Cursor
Edit `~/.cursor/mcp.json` or `.vscode/mcp.json`:
```json
{
"mcpServers": {
"mt5-quant": {
"command": "~/.local/bin/mt5-quant"
}
}
}
```
## 10. MCP Client Registration
After installing the binary, register with your MCP clients:
### Windsurf
## 2. Monitor CI
// turbo
```bash
# Add to Windsurf MCP config
cat >> ~/.codeium/windsurf/mcp_config.json << 'EOF'
{
"mcpServers": {
"io.github.masdevid/mt5-quant": {
"command": "~/.local/bin/mt5-quant",
"disabled": false,
"registry": "io.github.masdevid/mt5-quant"
}
}
}
EOF
gh run list --limit 3
```
### Claude Code
CI pipeline stages:
1. **build-macos** / **build-linux** — parallel Rust builds with cache
2. **release** — creates GitHub Release with both binaries
3. **build-mcp-package** — packages binary + config + docs, computes SHA256
4. **update-server-json** — commits real SHA256 back to `server.json` on master
5. **mcp-publish** — publishes to MCP Registry via GitHub OIDC
6. **release-info** — prints registration commands for all MCP clients
---
## 3. Install locally
// turbo
```bash
# Register with Claude Code
claude mcp add io.github.masdevid/mt5-quant -- ~/.local/bin/mt5-quant
# Or with custom name
claude mcp add mt5-quant -- ~/.local/bin/mt5-quant
cp target/release/mt5-quant ~/.local/bin/mt5-quant
```
### VS Code / Cursor
---
## 4. Verify
// turbo
```bash
# Add to Cursor MCP config
mkdir -p ~/.cursor
cat > ~/.cursor/mcp.json << 'EOF'
{
"mcpServers": {
"mt5-quant": {
"command": "~/.local/bin/mt5-quant",
"env": {
"MT5_MCP_HOME": "~/.config/mt5-quant"
}
}
}
}
EOF
```
## 11. Post-Release Verification
// turbo
```bash
# Test the binary
./target/release/mt5-quant --help
# Verify tool count
./target/release/mt5-quant 2>&1 | head -20
# Check MCP registration
claude mcp list
```
## Quick Release Commands
---
## Manual MCP publish (if CI publish fails)
// turbo
```bash
# Get latest mcp-publisher
LATEST=$(curl -sf https://api.github.com/repos/modelcontextprotocol/registry/releases/latest | python3 -c "import sys,json; print(json.load(sys.stdin)['tag_name'])")
VERSION="${LATEST#v}"
curl -fsSL -o pub.tar.gz "https://github.com/modelcontextprotocol/registry/releases/download/${LATEST}/mcp-publisher_${VERSION}_$(uname -s | tr '[:upper:]' '[:lower:]')_amd64.tar.gz"
tar -xzf pub.tar.gz && chmod +x mcp-publisher
./mcp-publisher login github
./mcp-publisher publish
```
---
## Re-trigger CI without a new tag
// turbo
```bash
gh workflow run release.yml -f version=v1.32.0
```
---
## Rollback
```bash
# Full release cycle
vim Cargo.toml # bump version
bash scripts/build-release.sh
git add . && git commit -m "Release vX.Y.Z"
git tag vX.Y.Z && git push origin vX.Y.Z
# Remove tag locally and remotely
git tag -d v1.32.0
git push origin :refs/tags/v1.32.0
# Delete GitHub Release
gh release delete v1.32.0 --yes
```