@@ -1096,61 +1096,109 @@ jobs:
10961096 token : ${{ secrets.HOMEBREW_TAP_TOKEN }}
10971097 path : tap
10981098
1099- - name : Update Homebrew formula
1099+ - name : Download platform binaries and calculate SHA256
11001100 run : |
11011101 VERSION=${GITHUB_REF#refs/tags/v}
11021102 echo "Processing version: ${VERSION}"
11031103
1104- cd tap
1104+ # Wait a bit for GitHub release assets to be available
1105+ sleep 15
11051106
1106- # Add debugging and retry logic
1107- ARCHIVE_URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${VERSION}.tar.gz"
1108- echo "Downloading from: ${ARCHIVE_URL }"
1107+ # Define platforms
1108+ PLATFORMS=("darwin-arm64" "darwin-amd64" "linux-arm64" "linux-amd64")
1109+ BASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION }"
11091110
1110- # Wait a bit for GitHub to generate the archive
1111- sleep 10
1111+ # Download each platform tarball and calculate SHA256
1112+ for PLATFORM in "${PLATFORMS[@]}"; do
1113+ TARBALL="mcpproxy-${VERSION}-${PLATFORM}.tar.gz"
1114+ URL="${BASE_URL}/${TARBALL}"
1115+ echo "Downloading ${PLATFORM}: ${URL}"
11121116
1113- # Try downloading with retries
1114- for i in {1..5}; do
1115- echo "Download attempt ${i}/5..."
1116- if wget -q "${ARCHIVE_URL}" -O "v${VERSION}.tar.gz"; then
1117- echo "Download successful"
1118- break
1119- else
1120- echo "Download failed, retrying in 10 seconds..."
1121- sleep 10
1122- fi
1123-
1124- if [ $i -eq 5 ]; then
1125- echo "All download attempts failed"
1126- echo "Checking if file exists at URL..."
1127- curl -I "${ARCHIVE_URL}" || true
1128- exit 1
1129- fi
1130- done
1117+ # Try downloading with retries
1118+ for i in {1..5}; do
1119+ echo " Attempt ${i}/5..."
1120+ if curl -fsSL "${URL}" -o "${TARBALL}"; then
1121+ echo " Download successful"
1122+ break
1123+ else
1124+ echo " Download failed, retrying in 10 seconds..."
1125+ sleep 10
1126+ fi
11311127
1132- # Verify file was downloaded
1133- if [ ! -f "v${VERSION}.tar.gz" ]; then
1134- echo "Archive file not found after download"
1135- ls -la
1136- exit 1
1137- fi
1128+ if [ $i -eq 5 ]; then
1129+ echo "All download attempts failed for ${PLATFORM}"
1130+ curl -I "${URL}" || true
1131+ exit 1
1132+ fi
1133+ done
11381134
1139- # Calculate SHA256
1140- SOURCE_SHA=$(sha256sum "v${VERSION}.tar.gz" | cut -d' ' -f1)
1141- echo "Calculated SHA256: ${SOURCE_SHA}"
1135+ # Calculate SHA256 and export as environment variable
1136+ SHA=$(sha256sum "${TARBALL}" | cut -d' ' -f1)
1137+ VAR_NAME="SHA256_$(echo ${PLATFORM} | tr '-' '_' | tr '[:lower:]' '[:upper:]')"
1138+ echo "${VAR_NAME}=${SHA}" >> $GITHUB_ENV
1139+ echo " SHA256: ${SHA}"
11421140
1143- # Create formula directory
1144- mkdir -p Formula
1141+ # Clean up tarball
1142+ rm -f "${TARBALL}"
1143+ done
11451144
1146- # Create formula file
1147- printf 'class Mcpproxy < Formula\n desc "Smart MCP Proxy - Intelligent tool discovery and proxying for Model Context Protocol servers"\n homepage "https://github.com/smart-mcp-proxy/mcpproxy-go"\n url "https://github.com/smart-mcp-proxy/mcpproxy-go/archive/refs/tags/v%s.tar.gz"\n sha256 "%s"\n license "MIT"\n head "https://github.com/smart-mcp-proxy/mcpproxy-go.git"\n\n depends_on "go" => :build\n\n def install\n system "go", "build", "-ldflags", "-s -w -X mcpproxy-go/cmd/mcpproxy.version=v%s -X main.version=v%s -X mcpproxy-go/internal/httpapi.buildVersion=v%s", "-o", "mcpproxy", "./cmd/mcpproxy"\n bin.install "mcpproxy"\n end\n\n test do\n assert_match version.to_s, shell_output("#{bin}/mcpproxy --version")\n end\nend\n' "${VERSION}" "${SOURCE_SHA}" "${VERSION}" "${VERSION}" "${VERSION}" > Formula/mcpproxy.rb
1145+ echo "VERSION=${VERSION}" >> $GITHUB_ENV
11481146
1149- echo "Formula created successfully"
1150- cat Formula/mcpproxy.rb
1147+ - name : Generate Homebrew formula
1148+ run : |
1149+ cd tap
1150+ mkdir -p Formula
11511151
1152- # Clean up
1153- rm -f *.tar.gz
1152+ cat > Formula/mcpproxy.rb << 'FORMULA_EOF'
1153+ class Mcpproxy < Formula
1154+ desc "Smart MCP Proxy - Intelligent tool discovery and proxying for MCP servers"
1155+ homepage "https://github.com/smart-mcp-proxy/mcpproxy-go"
1156+ version "${VERSION}"
1157+ license "MIT"
1158+
1159+ on_macos do
1160+ if Hardware::CPU.arm?
1161+ url "https://github.com/smart-mcp-proxy/mcpproxy-go/releases/download/v${VERSION}/mcpproxy-${VERSION}-darwin-arm64.tar.gz"
1162+ sha256 "${SHA256_DARWIN_ARM64}"
1163+ else
1164+ url "https://github.com/smart-mcp-proxy/mcpproxy-go/releases/download/v${VERSION}/mcpproxy-${VERSION}-darwin-amd64.tar.gz"
1165+ sha256 "${SHA256_DARWIN_AMD64}"
1166+ end
1167+ end
1168+
1169+ on_linux do
1170+ if Hardware::CPU.arm?
1171+ url "https://github.com/smart-mcp-proxy/mcpproxy-go/releases/download/v${VERSION}/mcpproxy-${VERSION}-linux-arm64.tar.gz"
1172+ sha256 "${SHA256_LINUX_ARM64}"
1173+ else
1174+ url "https://github.com/smart-mcp-proxy/mcpproxy-go/releases/download/v${VERSION}/mcpproxy-${VERSION}-linux-amd64.tar.gz"
1175+ sha256 "${SHA256_LINUX_AMD64}"
1176+ end
1177+ end
1178+
1179+ def install
1180+ bin.install "mcpproxy"
1181+ bin.install "mcpproxy-tray" if OS.mac? && File.exist?("mcpproxy-tray")
1182+ end
1183+
1184+ test do
1185+ assert_match version.to_s, shell_output("#{bin}/mcpproxy --version")
1186+ end
1187+ end
1188+ FORMULA_EOF
1189+
1190+ # Remove the 10-space YAML indentation from the formula
1191+ sed -i 's/^ //' Formula/mcpproxy.rb
1192+
1193+ # Substitute environment variables
1194+ sed -i "s/\${VERSION}/${VERSION}/g" Formula/mcpproxy.rb
1195+ sed -i "s/\${SHA256_DARWIN_ARM64}/${SHA256_DARWIN_ARM64}/g" Formula/mcpproxy.rb
1196+ sed -i "s/\${SHA256_DARWIN_AMD64}/${SHA256_DARWIN_AMD64}/g" Formula/mcpproxy.rb
1197+ sed -i "s/\${SHA256_LINUX_ARM64}/${SHA256_LINUX_ARM64}/g" Formula/mcpproxy.rb
1198+ sed -i "s/\${SHA256_LINUX_AMD64}/${SHA256_LINUX_AMD64}/g" Formula/mcpproxy.rb
1199+
1200+ echo "Formula created successfully:"
1201+ cat Formula/mcpproxy.rb
11541202
11551203 - name : Commit and push changes
11561204 run : |
@@ -1163,7 +1211,7 @@ jobs:
11631211 if git diff --staged --quiet; then
11641212 echo "No changes to commit"
11651213 else
1166- git commit -m "Update mcpproxy to ${GITHUB_REF#refs/tags/v} "
1214+ git commit -m "Update mcpproxy to ${VERSION} (pre-built binaries) "
11671215 git push
11681216 echo "Changes committed and pushed successfully"
11691217 fi
0 commit comments