Skip to content

Commit 7db5a1f

Browse files
authored
feat: add macOS and Windows GHA runners support (#16)
1 parent 292e542 commit 7db5a1f

File tree

1 file changed

+56
-6
lines changed

1 file changed

+56
-6
lines changed

action.yml

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,51 @@ runs:
204204
return 1
205205
}
206206
207+
# Detect platform
208+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
209+
ARCH=$(uname -m)
210+
211+
case "$OS" in
212+
linux)
213+
PLATFORM="linux"
214+
;;
215+
darwin)
216+
PLATFORM="darwin"
217+
;;
218+
mingw*|msys*|cygwin*)
219+
PLATFORM="windows"
220+
;;
221+
*)
222+
echo "::error::Unsupported operating system: $OS"
223+
exit 1
224+
;;
225+
esac
226+
227+
case "$ARCH" in
228+
x86_64|amd64)
229+
ARCH_NAME="amd64"
230+
;;
231+
aarch64|arm64)
232+
ARCH_NAME="arm64"
233+
;;
234+
*)
235+
echo "::error::Unsupported architecture: $ARCH"
236+
exit 1
237+
;;
238+
esac
239+
240+
CAGENT_BINARY="cagent-${PLATFORM}-${ARCH_NAME}"
241+
if [[ "$PLATFORM" == "windows" ]]; then
242+
CAGENT_BINARY="${CAGENT_BINARY}.exe"
243+
fi
244+
245+
echo "Detected platform: $PLATFORM-$ARCH_NAME"
246+
207247
# Download cagent if not cached
208248
if [[ "$CAGENT_CACHE_HIT" != "true" ]]; then
209-
echo "Downloading cagent $CAGENT_VERSION..."
249+
echo "Downloading cagent $CAGENT_VERSION for $PLATFORM-$ARCH_NAME..."
210250
retry_download \
211-
"https://github.com/docker/cagent/releases/download/$CAGENT_VERSION/cagent-linux-amd64" \
251+
"https://github.com/docker/cagent/releases/download/$CAGENT_VERSION/$CAGENT_BINARY" \
212252
"$GITHUB_WORKSPACE/cagent"
213253
chmod +x "$GITHUB_WORKSPACE/cagent"
214254
else
@@ -224,14 +264,24 @@ runs:
224264
# Download mcp-gateway if needed and not cached
225265
if [[ "$MCP_GATEWAY" == "true" ]]; then
226266
if [[ "$MCP_CACHE_HIT" != "true" ]]; then
227-
echo "Downloading mcp-gateway $MCP_GATEWAY_VERSION..."
267+
echo "Downloading mcp-gateway $MCP_GATEWAY_VERSION for $PLATFORM-$ARCH_NAME..."
268+
MCP_BINARY="docker-mcp-${PLATFORM}-${ARCH_NAME}.tar.gz"
228269
retry_download \
229-
"https://github.com/docker/mcp-gateway/releases/download/$MCP_GATEWAY_VERSION/docker-mcp-linux-amd64.tar.gz" \
270+
"https://github.com/docker/mcp-gateway/releases/download/$MCP_GATEWAY_VERSION/$MCP_BINARY" \
230271
"mcp-gateway.tar.gz"
231272
tar -xzf mcp-gateway.tar.gz
273+
274+
if [[ "$PLATFORM" == "windows" ]]; then
275+
MCP_PLUGIN_DIR="$USERPROFILE/.docker/cli-plugins"
276+
MCP_BINARY_NAME="docker-mcp.exe"
277+
else
278+
MCP_PLUGIN_DIR="$HOME/.docker/cli-plugins"
279+
MCP_BINARY_NAME="docker-mcp"
280+
fi
281+
232282
chmod +x docker-mcp
233-
mkdir -p ~/.docker/cli-plugins
234-
cp docker-mcp ~/.docker/cli-plugins/docker-mcp
283+
mkdir -p "$MCP_PLUGIN_DIR"
284+
cp docker-mcp "$MCP_PLUGIN_DIR/$MCP_BINARY_NAME"
235285
else
236286
echo "Using cached mcp-gateway binary"
237287
fi

0 commit comments

Comments
 (0)