Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/release.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions .github/workflows/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,26 @@ jobs:
run: make test

- name: Build binary
run: make build
run: |
RELEASE_TAG="${GITHUB_REF#refs/tags/}"
echo "Building multi-platform binaries for: $RELEASE_TAG"
chmod +x scripts/build-release.sh
./scripts/build-release.sh "$RELEASE_TAG"

- name: Create release
- name: Upload binaries to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_TAG="${GITHUB_REF#refs/tags/}"
echo "Creating release for tag: $RELEASE_TAG"

# Create release with the binary
# Create release with all binaries and checksums
gh release create "$RELEASE_TAG" \
--title "$RELEASE_TAG" \
--generate-notes \
./awmg
dist/*

echo "✓ Release created with binary"
echo "✓ Release created with all platform binaries and checksums"

- name: Get release ID
id: get_release
Expand Down
12 changes: 10 additions & 2 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ var (
envFile string
enableDIFC bool
debugLog = logger.New("cmd:root")
version = "dev" // Default version, overridden by SetVersion
)

var rootCmd = &cobra.Command{
Use: "awmg",
Short: "MCPG MCP proxy server",
Use: "awmg",
Short: "MCPG MCP proxy server",
Version: version,
Long: `MCPG is a proxy server for Model Context Protocol (MCP) servers.
It provides routing, aggregation, and management of multiple MCP backend servers.`,
RunE: run,
Expand Down Expand Up @@ -193,3 +195,9 @@ func Execute() {
os.Exit(1)
}
}

// SetVersion sets the version string for the CLI
func SetVersion(v string) {
version = v
rootCmd.Version = v
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package main
import "github.com/githubnext/gh-aw-mcpg/internal/cmd"

func main() {
cmd.SetVersion(Version)
cmd.Execute()
}
78 changes: 78 additions & 0 deletions scripts/build-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash
# Custom build script for multi-platform builds of awmg
# This script is called during the release process to build binaries for all platforms
set -e

VERSION="$1"

if [ -z "$VERSION" ]; then
echo "error: VERSION argument is required" >&2
exit 1
fi

platforms=(
darwin-amd64
darwin-arm64
freebsd-386
freebsd-amd64
freebsd-arm64
linux-386
linux-amd64
linux-arm
linux-arm64
windows-386
windows-amd64
windows-arm64
)

echo "Building binaries with version: $VERSION"

# Create dist directory if it doesn't exist
mkdir -p dist

IFS=$'\n' read -d '' -r -a supported_platforms < <(go tool dist list) || true

for p in "${platforms[@]}"; do
goos="${p%-*}"
goarch="${p#*-}"

# Check if platform is supported
if [[ " ${supported_platforms[*]} " != *" ${goos}/${goarch} "* ]]; then
echo "warning: skipping unsupported platform $p" >&2
continue
fi

ext=""
if [ "$goos" = "windows" ]; then
ext=".exe"
fi

echo "Building awmg for $p..."
GOOS="$goos" GOARCH="$goarch" go build \
-trimpath \
-ldflags="-s -w -X main.Version=${VERSION}" \
-o "dist/awmg-${p}${ext}" \
.

done

echo "Build complete. Binaries:"
ls -lh dist/

# Generate checksums file
echo ""
echo "Generating checksums..."
cd dist
# Use sha256sum if available (Linux), otherwise use shasum (macOS)
if command -v sha256sum &> /dev/null; then
sha256sum * > checksums.txt
elif command -v shasum &> /dev/null; then
shasum -a 256 * > checksums.txt
else
echo "error: neither sha256sum nor shasum is available" >&2
exit 1
fi
cd ..

echo "Checksums generated:"
cat dist/checksums.txt
8 changes: 8 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package main

// Build-time variables set during release builds
var (
// Version is the semantic version of the binary (e.g., "v1.0.0")
// Set via -ldflags "-X main.Version=<version>" during build
Version = "dev"
)