From f3bf1090ca03c7c27790a897f96579fdbb162dd0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 23:27:27 +0000 Subject: [PATCH 1/4] Initial plan From c195b0610a090ff558f963e8654aeebb69eee327 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 23:31:49 +0000 Subject: [PATCH 2/4] Import multi-platform build code from gh-aw Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/release.lock.yml | 14 ++++-- .github/workflows/release.md | 14 ++++-- scripts/build-release.sh | 78 ++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 10 deletions(-) create mode 100755 scripts/build-release.sh diff --git a/.github/workflows/release.lock.yml b/.github/workflows/release.lock.yml index 8838c6b9..d681b063 100644 --- a/.github/workflows/release.lock.yml +++ b/.github/workflows/release.lock.yml @@ -1257,19 +1257,23 @@ jobs: - name: Run tests run: make test - name: Build binary - run: make build - - name: Create release + 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: Upload binaries to release 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" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get release ID diff --git a/.github/workflows/release.md b/.github/workflows/release.md index 029bcf98..19023850 100644 --- a/.github/workflows/release.md +++ b/.github/workflows/release.md @@ -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 diff --git a/scripts/build-release.sh b/scripts/build-release.sh new file mode 100755 index 00000000..564bd825 --- /dev/null +++ b/scripts/build-release.sh @@ -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 with proper version info +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 From d446fe6de7e4a8377a7ea2f4230eb179d4709710 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 23:35:56 +0000 Subject: [PATCH 3/4] Remove unused version injection and update comments Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- scripts/build-release.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 564bd825..2f514524 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -1,6 +1,7 @@ #!/bin/bash # Custom build script for multi-platform builds of awmg -# This script is called during the release process to build binaries with proper version info +# This script is called during the release process to build binaries for all platforms +# Note: Version injection is not yet implemented in this project set -e VERSION="$1" @@ -10,6 +11,8 @@ if [ -z "$VERSION" ]; then exit 1 fi +# Note: VERSION parameter is currently unused but kept for compatibility with future version injection + platforms=( darwin-amd64 darwin-arm64 @@ -50,7 +53,7 @@ for p in "${platforms[@]}"; do echo "Building awmg for $p..." GOOS="$goos" GOARCH="$goarch" go build \ -trimpath \ - -ldflags="-s -w -X main.version=${VERSION}" \ + -ldflags="-s -w" \ -o "dist/awmg-${p}${ext}" \ . From 30d05574f5685aa8df8ad97b2533689c2ead02c7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 23:49:41 +0000 Subject: [PATCH 4/4] Add version variable support in version.go and update build script Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- internal/cmd/root.go | 12 ++++++++++-- main.go | 1 + scripts/build-release.sh | 5 +---- version.go | 8 ++++++++ 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 version.go diff --git a/internal/cmd/root.go b/internal/cmd/root.go index ee6a30a6..b82b95f2 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -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, @@ -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 +} diff --git a/main.go b/main.go index 7bb6f6a3..8a6c9101 100644 --- a/main.go +++ b/main.go @@ -3,5 +3,6 @@ package main import "github.com/githubnext/gh-aw-mcpg/internal/cmd" func main() { + cmd.SetVersion(Version) cmd.Execute() } diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 2f514524..a77be2c7 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -1,7 +1,6 @@ #!/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 -# Note: Version injection is not yet implemented in this project set -e VERSION="$1" @@ -11,8 +10,6 @@ if [ -z "$VERSION" ]; then exit 1 fi -# Note: VERSION parameter is currently unused but kept for compatibility with future version injection - platforms=( darwin-amd64 darwin-arm64 @@ -53,7 +50,7 @@ for p in "${platforms[@]}"; do echo "Building awmg for $p..." GOOS="$goos" GOARCH="$goarch" go build \ -trimpath \ - -ldflags="-s -w" \ + -ldflags="-s -w -X main.Version=${VERSION}" \ -o "dist/awmg-${p}${ext}" \ . diff --git a/version.go b/version.go new file mode 100644 index 00000000..91da8bc0 --- /dev/null +++ b/version.go @@ -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=" during build + Version = "dev" +)