Skip to content

Commit 110034f

Browse files
committed
Make cosmocc install robust to zip layout variations
1 parent ef3913a commit 110034f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,23 @@ jobs:
2727
2828
- name: Install Cosmocc 4.0.2
2929
run: |
30+
set -euo pipefail
3031
curl -fL "https://cosmo.zip/pub/cosmocc/cosmocc-4.0.2.zip" -o cosmocc.zip
3132
COSMO_ROOT="$RUNNER_TEMP/cosmocc"
3233
rm -rf "$COSMO_ROOT"
3334
mkdir -p "$COSMO_ROOT"
3435
unzip -q -o cosmocc.zip -d "$COSMO_ROOT"
35-
COSMO_DIR="$(find "$COSMO_ROOT" -maxdepth 1 -type d -name 'cosmocc-*' | head -n 1)"
36-
test -n "$COSMO_DIR"
36+
COSMO_DIR="$(find "$COSMO_ROOT" -maxdepth 1 -type d -name 'cosmocc-*' | head -n 1 || true)"
37+
if [ -z "${COSMO_DIR:-}" ]; then
38+
if [ -x "$COSMO_ROOT/bin/cosmocc" ]; then
39+
COSMO_DIR="$COSMO_ROOT"
40+
else
41+
echo "cosmocc installation layout not detected in $COSMO_ROOT"
42+
find "$COSMO_ROOT" -maxdepth 3 -type f | head -n 50
43+
exit 1
44+
fi
45+
fi
46+
test -x "$COSMO_DIR/bin/cosmocc"
3747
echo "$COSMO_DIR/bin" >> "$GITHUB_PATH"
3848
"$COSMO_DIR/bin/cosmocc" --version
3949

0 commit comments

Comments
 (0)