Skip to content

Commit 885fdc3

Browse files
authored
fix(canary): use curl instead of gh CLI for release download (#299)
1 parent d5c2483 commit 885fdc3

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

.github/workflows/release-canary.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,52 @@ jobs:
7575
run: |
7676
set -euo pipefail
7777
TAG="${{ steps.release.outputs.tag }}"
78-
ASSET="openshell-${{ matrix.target }}.tar.gz"
78+
ASSET_NAME="openshell-${{ matrix.target }}.tar.gz"
79+
API="https://api.github.com/repos/${{ github.repository }}"
7980
80-
echo "Downloading ${ASSET} from release ${TAG}..."
81-
gh release download "${TAG}" \
82-
--repo "${{ github.repository }}" \
83-
--pattern "${ASSET}" \
84-
--output "/tmp/${ASSET}"
81+
echo "Downloading ${ASSET_NAME} from release ${TAG}..."
8582
86-
tar -xzf "/tmp/${ASSET}" -C /tmp
83+
# Look up the asset download URL via the releases API
84+
ASSET_URL=$(curl -fsSL \
85+
-H "Authorization: token ${GH_TOKEN}" \
86+
"${API}/releases/tags/${TAG}" \
87+
| jq -r --arg name "${ASSET_NAME}" \
88+
'.assets[] | select(.name == $name) | .url')
89+
90+
if [ -z "$ASSET_URL" ] || [ "$ASSET_URL" = "null" ]; then
91+
echo "::error::Asset ${ASSET_NAME} not found in release ${TAG}"
92+
exit 1
93+
fi
94+
95+
# Download the asset binary
96+
curl -fsSL \
97+
-H "Authorization: token ${GH_TOKEN}" \
98+
-H "Accept: application/octet-stream" \
99+
-o "/tmp/${ASSET_NAME}" \
100+
"${ASSET_URL}"
101+
102+
tar -xzf "/tmp/${ASSET_NAME}" -C /tmp
87103
install -m 755 /tmp/openshell /usr/local/bin/openshell
88-
rm -f "/tmp/${ASSET}" /tmp/openshell
104+
rm -f "/tmp/${ASSET_NAME}" /tmp/openshell
89105
env:
90106
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91107

92108
- name: Verify CLI installation
93109
run: openshell --version
94110

111+
- name: Resolve gateway host
112+
run: |
113+
# On Linux CI runners host.docker.internal is not set automatically
114+
# (it's a Docker Desktop feature). Add it via the Docker bridge IP.
115+
if ! getent hosts host.docker.internal >/dev/null 2>&1; then
116+
BRIDGE_IP=$(docker network inspect bridge --format '{{(index .IPAM.Config 0).Gateway}}')
117+
echo "Adding /etc/hosts entry: ${BRIDGE_IP} host.docker.internal"
118+
echo "${BRIDGE_IP} host.docker.internal" >> /etc/hosts
119+
fi
120+
121+
- name: Start gateway
122+
run: openshell gateway start --gateway-host host.docker.internal
123+
95124
- name: Run canary test
96125
run: |
97126
set -euo pipefail

0 commit comments

Comments
 (0)