name: ๐ฆ NPM Package Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version_type:
description: 'Version bump type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
env:
GO_VERSION: '1.23'
NODE_VERSION: '18'
jobs:
# Build Go binaries for all platforms
build-binaries:
name: ๐จ Build Go Binaries
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
exclude:
# Exclude Windows ARM64 for now (can be added if needed)
- goos: windows
goarch: arm64
steps:
- name: ๐ฅ Checkout code
uses: actions/checkout@v4
- name: ๐ง Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: ๐ Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('gorev-mcpserver/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: ๐๏ธ Build binary
working-directory: ./gorev-mcpserver
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
# Set binary name based on OS
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY_NAME="gorev-${{ matrix.goos }}-${{ matrix.goarch }}.exe"
else
BINARY_NAME="gorev-${{ matrix.goos }}-${{ matrix.goarch }}"
fi
echo "Building for ${{ matrix.goos }}/${{ matrix.goarch }}"
echo "Binary name: $BINARY_NAME"
# Build with version info
go build -ldflags "-s -w -X main.version=${GITHUB_REF_NAME:-dev}" -o "../gorev-npm/binaries/${{ matrix.goos }}-${{ matrix.goarch }}/${BINARY_NAME##*-}" ./cmd/gorev
- name: ๐ค Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.goos }}-${{ matrix.goarch }}
path: gorev-npm/binaries/${{ matrix.goos }}-${{ matrix.goarch }}/
retention-days: 1
# Test NPM package
test-npm-package:
name: ๐งช Test NPM Package
runs-on: ${{ matrix.os }}
needs: build-binaries
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16, 18, 20]
steps:
- name: ๐ฅ Checkout code
uses: actions/checkout@v4
- name: ๐ง Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: ๐ฅ Download all binary artifacts
uses: actions/download-artifact@v4
with:
pattern: binary-*
path: gorev-npm/binaries/
merge-multiple: true
- name: ๐ง Setup binaries structure
working-directory: ./gorev-npm
shell: bash
run: |
# Reorganize binaries from flat structure to platform directories
mkdir -p binaries-temp
mv binaries binaries-temp/flat
mkdir -p binaries
# Recreate proper structure
for dir in binaries-temp/flat/binary-*; do
if [ -d "$dir" ]; then
platform=$(basename "$dir" | sed 's/binary-//')
mkdir -p "binaries/$platform"
cp -r "$dir"/* "binaries/$platform/" || true
fi
done
# Clean up
rm -rf binaries-temp
# List the structure for debugging
echo "Binaries structure:"
find binaries -type f
- name: ๐ง Make binaries executable
if: runner.os != 'Windows'
working-directory: ./gorev-npm
run: |
find binaries -name "gorev" -type f -exec chmod +x {} \;
- name: ๐ฆ Install package dependencies
working-directory: ./gorev-npm
run: npm install
- name: ๐งช Test package installation
working-directory: ./gorev-npm
run: |
# Test the wrapper directly
node index.js --version
# Test via npx simulation
node bin/gorev-mcp --help
- name: ๐งช Test MCP server startup
working-directory: ./gorev-npm
timeout-minutes: 2
run: |
# Start server and check if it responds (basic smoke test)
timeout 10 node index.js serve || true
# Publish to NPM
publish-npm:
name: ๐ Publish to NPM
runs-on: ubuntu-latest
needs: [build-binaries, test-npm-package]
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
steps:
- name: ๐ฅ Checkout code
uses: actions/checkout@v4
- name: ๐ง Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: ๐ฅ Download all binary artifacts
uses: actions/download-artifact@v4
with:
pattern: binary-*
path: gorev-npm/binaries/
merge-multiple: true
- name: ๐ง Setup binaries structure
working-directory: ./gorev-npm
run: |
# Reorganize binaries from artifacts structure
mkdir -p binaries-temp
mv binaries binaries-temp/flat
mkdir -p binaries
# Recreate proper platform directories
for dir in binaries-temp/flat/binary-*; do
if [ -d "$dir" ]; then
platform=$(basename "$dir" | sed 's/binary-//')
mkdir -p "binaries/$platform"
cp -r "$dir"/* "binaries/$platform/"
fi
done
# Clean up temp directory
rm -rf binaries-temp
# Verify structure
echo "Final binaries structure:"
find binaries -type f
# Make Unix binaries executable
find binaries -name "gorev" -type f -exec chmod +x {} \;
- name: ๐ Update package version
working-directory: ./gorev-npm
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
# Manual trigger - bump version
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
else
# Tag push - use tag version
VERSION=${GITHUB_REF_NAME#v}
npm version $VERSION --no-git-tag-version
fi
- name: ๐ฆ Install dependencies
working-directory: ./gorev-npm
run: npm install --production
- name: ๐งช Final package validation
working-directory: ./gorev-npm
run: |
# Validate package.json
npm pack --dry-run
# Test the package
node index.js --version
- name: ๐ Publish to NPM
working-directory: ./gorev-npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "Publishing @mehmetsenol/gorev-mcp-server to NPM..."
npm publish --access public
- name: ๐ Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Gorev ${{ github.ref_name }}
body: |
## ๐ Gorev MCP Server ${{ github.ref_name }}
### ๐ฆ NPM Package Available
You can now install and use Gorev MCP Server with a simple npx command:
```bash
npx @mehmetsenol/gorev-mcp-server@latest
```
### ๐ง MCP Configuration
Add to your `mcp.json`:
```json
{
"mcpServers": {
"gorev": {
"command": "npx",
"args": ["@mehmetsenol/gorev-mcp-server@latest"],
"env": {
"GOREV_LANG": "tr"
}
}
}
}
```
### ๐ฑ Supported Platforms
- โ
Windows (amd64)
- โ
macOS (amd64, arm64)
- โ
Linux (amd64, arm64)
### ๐ Documentation
- [Installation Guide](https://github.com/msenol/Gorev#-kurulum)
- [MCP Tools Reference](https://github.com/msenol/Gorev/blob/main/docs/mcp-araclari.md)
- [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=mehmetsenol.gorev-vscode)
draft: false
prerelease: false
# Publish to MCP Registry
publish-mcp-registry:
name: ๐ Publish to MCP Registry
runs-on: ubuntu-latest
needs: [publish-npm]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
contents: read
steps:
- name: ๐ฅ Checkout code
uses: actions/checkout@v4
- name: ๐ง Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: ๐ Update server.json version
run: |
VERSION=${GITHUB_REF_NAME#v}
jq --arg version "$VERSION" '.version = $version' server.json > server.json.tmp
mv server.json.tmp server.json
echo "Updated server.json version to: $VERSION"
- name: ๐ Validate server.json schema
run: |
# Install jsonschema validator if not available
pip install jsonschema
# Download schema and validate
curl -s https://registry.modelcontextprotocol.io/v0/schema/server.json -o schema.json || echo "Schema download failed, skipping validation"
python -c "
import json
import jsonschema
with open('server.json') as f:
server_config = json.load(f)
with open('schema.json') as f:
schema = json.load(f)
try:
jsonschema.validate(server_config, schema)
print('โ
server.json is valid according to schema')
except jsonschema.ValidationError as e:
print(f'โ Validation error: {e}')
exit(1)
"
- name: ๐ฆ Install MCP Publisher
run: |
# Download latest mcp-publisher
curl -L "https://github.com/modelcontextprotocol/publisher/releases/latest/download/mcp-publisher-linux-amd64.tar.gz" | tar xz
chmod +x mcp-publisher
echo "$(pwd)" >> $GITHUB_PATH
- name: ๐ Login to MCP Registry
run: |
mcp-publisher login github-oidc
- name: ๐ Publish to MCP Registry
run: |
echo "Publishing to MCP Registry..."
mcp-publisher publish
- name: โ
Verify Publication
run: |
echo "๐ Successfully published io.github.msenol.gorev to MCP Registry"
echo "You can now find it at: https://registry.modelcontextprotocol.io/servers/io.github.msenol.gorev"
# Clean up artifacts
cleanup:
name: ๐งน Cleanup
runs-on: ubuntu-latest
needs: [publish-npm]
if: always()
steps:
- name: ๐๏ธ Delete artifacts
uses: actions/github-script@v7
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
});
for (const artifact of artifacts.data.artifacts) {
if (artifact.name.startsWith('binary-')) {
await github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
});
console.log(`Deleted artifact: ${artifact.name}`);
}
}