Introduce Goreleaser (#366)

<!-- Provide a brief summary of your changes -->

## Motivation and Context
<!-- Why is this change needed? What problem does it solve? -->
The following PR introduces Goreleaser for the releases of the registry
server and the publisher CLI.

**Details:**
- Builds registry and publisher binaries for Linux, macOS, and Windows
(amd64 + arm64)
- Leverage GitHub's release process by creating releases directly from
GitHub's interface
- Added .goreleaser.yaml configuration
- New .github/workflows/release.yml workflow triggered by GitHub
releases
- Updated Docker tagging in deploy workflow (:latest and :semver(the
tag) for releases, :main-YYYYMMDD-sha for testing/development)
- Consolidated version handling in main.go files
- Added release documentation

## How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were
tested? -->

Locally (but we have to test it by creating a release, i.e. v0.0.1 once
this gets merged)

## Breaking Changes
<!-- Will users need to update their code or configurations? -->
Yes, the notion of `latest` for the container image is now different

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ ] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [ ] My code follows the repository's style guidelines
- [ ] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [ ] I have added or updated documentation as needed

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->
Related to #358

---------

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
This commit is contained in:
Radoslav Dimitrov 2025-09-08 21:03:39 +03:00 • committed by GitHub
commit 16790150e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 273 additions and 65 deletions

View file

@ -1,41 +0,0 @@
#!/bin/bash
# Build script for MCP Registry Publisher Tool
# Set variables
OUTPUT_DIR="./bin"
BINARY_NAME="mcp-publisher"
# Create output directory if it doesn't exist
mkdir -p $OUTPUT_DIR
# Print build information
echo "Building MCP Registry Publisher Tool..."
# Build for current platform
echo "Building for $(go env GOOS)/$(go env GOARCH)..."
go build -o "$OUTPUT_DIR/$BINARY_NAME" .
# Make the binary executable
chmod +x "$OUTPUT_DIR/$BINARY_NAME"
echo "Build complete: $(realpath $OUTPUT_DIR/$BINARY_NAME)"
# Optional: Build for multiple platforms
if [ "$1" == "--all" ]; then
echo "Building for all supported platforms..."
# Linux AMD64
GOOS=linux GOARCH=amd64 go build -o "$OUTPUT_DIR/${BINARY_NAME}-linux-amd64" .
# MacOS AMD64
GOOS=darwin GOARCH=amd64 go build -o "$OUTPUT_DIR/${BINARY_NAME}-darwin-amd64" .
# MacOS ARM64 (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o "$OUTPUT_DIR/${BINARY_NAME}-darwin-arm64" .
# Windows AMD64
GOOS=windows GOARCH=amd64 go build -o "$OUTPUT_DIR/${BINARY_NAME}-windows-amd64.exe" .
echo "Multi-platform build complete in $(realpath $OUTPUT_DIR)"
fi

View file

@ -2,11 +2,25 @@ package main
import (
"fmt"
"log"
"os"
"github.com/modelcontextprotocol/registry/cmd/publisher/commands"
)
// Version info for the MCP Publisher tool
// These variables are injected at build time via ldflags by goreleaser
var (
// Version is the current version of the MCP Publisher tool
Version = "dev"
// BuildTime is the time at which the binary was built
BuildTime = "unknown"
// GitCommit is the git commit that was compiled
GitCommit = "unknown"
)
func main() {
if len(os.Args) < 2 {
printUsage()
@ -23,6 +37,9 @@ func main() {
err = commands.LogoutCommand()
case "publish":
err = commands.PublishCommand(os.Args[2:])
case "--version", "-v", "version":
log.Printf("mcp-publisher %s (commit: %s, built: %s)", Version, GitCommit, BuildTime)
return
case "--help", "-h", "help":
printUsage()
default:

View file

@ -19,6 +19,19 @@ import (
"github.com/modelcontextprotocol/registry/internal/telemetry"
)
// Version info for the MCP Registry application
// These variables are injected at build time via ldflags
var (
// Version is the current version of the MCP Registry application
Version = "dev"
// BuildTime is the time at which the binary was built
BuildTime = "unknown"
// GitCommit is the git commit that was compiled
GitCommit = "unknown"
)
func main() {
// Parse command line flags
showVersion := flag.Bool("version", false, "Display version information")

View file

@ -1,13 +0,0 @@
package main
// Version info for the MCP Registry application
var (
// Version is the current version of the MCP Registry application
Version = "0.1.0"
// BuildTime is the time at which the binary was built
BuildTime = "undefined"
// GitCommit is the git commit that was compiled
GitCommit = "undefined"
)