Skip to content

Commit 3774433

Browse files
committed
Improve macOS DMG workflow by implementing a robust mechanism to locate and install the ssh-studio-resources.gresource file from multiple potential paths, with error handling for missing resources.
1 parent 09a4c96 commit 3774433

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

.github/workflows/macos-dmg.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,25 @@ jobs:
143143
rsync -a src/ "$RES/python/ssh_studio/"
144144
# 2) Copy compiled GResource from Meson install
145145
APP_ID="io.github.BuddySirJava.SSH-Studio"
146-
install -m 0644 "stage/share/$APP_ID/ssh-studio-resources.gresource" "$RES/"
146+
RES_GRES="$RES/ssh-studio-resources.gresource"
147+
SRC_GRES=""
148+
for CAND in \
149+
"stage/share/$APP_ID/ssh-studio-resources.gresource" \
150+
"build/data/ssh-studio-resources.gresource" \
151+
"_build/data/ssh-studio-resources.gresource"; do
152+
if [ -f "$CAND" ]; then
153+
SRC_GRES="$CAND"
154+
break
155+
fi
156+
done
157+
if [ -n "$SRC_GRES" ]; then
158+
install -m 0644 "$SRC_GRES" "$RES_GRES"
159+
else
160+
echo "ERROR: Could not find ssh-studio-resources.gresource in expected locations" >&2
161+
ls -la stage/share "$PWD"/build/data "$PWD"/_build/data || true
162+
exit 1
163+
fi
164+
ls -la "$RES" || true
147165
148166
# 3) Vendor Python.framework
149167
BREW_PREFIX="$(brew --prefix)"
@@ -227,7 +245,18 @@ jobs:
227245
"$PYBIN" - <<'PY'
228246
import os, sys
229247
from gi.repository import Gio
230-
res_path = os.path.join(os.path.dirname(__file__), '..', 'Resources', 'ssh-studio-resources.gresource')
248+
base = os.path.dirname(__file__)
249+
candidates = [
250+
os.path.join(base, '..', 'Resources', 'ssh-studio-resources.gresource'),
251+
os.path.join(base, '..', 'Resources', 'share', 'io.github.BuddySirJava.SSH-Studio', 'ssh-studio-resources.gresource'),
252+
]
253+
res_path = None
254+
for c in candidates:
255+
if os.path.exists(c):
256+
res_path = c
257+
break
258+
if not res_path:
259+
raise SystemExit('ssh-studio-resources.gresource not found in expected locations')
231260
Gio.resources_register(Gio.Resource.load(res_path))
232261
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'Resources', 'python'))
233262
from ssh_studio import main as _main

0 commit comments

Comments
 (0)