@@ -37,22 +37,27 @@ jobs:
3737 setup_libs : sh ./install-haxelibs.sh
3838 extra_libs : |
3939 sudo apt-get update
40- sudo apt-get install -y libvlc-dev libvlccore-dev dpkg-dev file
40+ sudo apt-get install -y libvlc-dev libvlccore-dev dpkg-dev file desktop-file-utils gtk-update-icon-cache
4141 pre_build_commands :
4242 post_build_commands : |
4343 set -euo pipefail
44+
4445 APP_DIR="export/release/linux/bin"
4546 [ -d "$APP_DIR" ] || { echo "Missing build output dir: $APP_DIR" >&2; exit 1; }
47+
4648 DEB_ROOT="dist/deb"
4749 VERSION="4.0.0+ci${{ github.run_id }}"
4850 DEB_NAME="ale-psych_${VERSION}_amd64.deb"
51+
4952 ELF_CANDIDATES=()
5053 OTHER_CANDIDATES=()
54+
5155 pick_largest() {
5256 local best=""
5357 local best_size=0
5458 local f size
5559 for f in "$@"; do
60+ [ -f "$f" ] || continue
5661 size=$(stat -c %s "$f")
5762 if [ "$size" -gt "$best_size" ]; then
5863 best="$f"
@@ -61,13 +66,15 @@ jobs:
6166 done
6267 printf '%s' "$best"
6368 }
69+
6470 while IFS= read -r -d '' f; do
6571 if file -b "$f" | grep -q "ELF"; then
6672 ELF_CANDIDATES+=("$f")
6773 else
6874 OTHER_CANDIDATES+=("$f")
6975 fi
7076 done < <(find "$APP_DIR" -maxdepth 1 -type f -executable ! -name "*.so*" -print0)
77+
7178 EXE_PATH=$(pick_largest "${ELF_CANDIDATES[@]}")
7279 if [ -z "$EXE_PATH" ]; then
7380 EXE_PATH=$(pick_largest "${OTHER_CANDIDATES[@]}")
@@ -77,11 +84,20 @@ jobs:
7784 ls -la "$APP_DIR"
7885 exit 1
7986 fi
87+
8088 EXE_NAME=$(basename "$EXE_PATH")
89+
8190 mkdir -p dist
8291 rm -rf "$DEB_ROOT"
83- mkdir -p "$DEB_ROOT/DEBIAN" "$DEB_ROOT/opt/ale-psych" "$DEB_ROOT/usr/bin" "$DEB_ROOT/usr/share/applications" "$DEB_ROOT/usr/share/metainfo"
92+ mkdir -p \
93+ "$DEB_ROOT/DEBIAN" \
94+ "$DEB_ROOT/opt/ale-psych" \
95+ "$DEB_ROOT/usr/bin" \
96+ "$DEB_ROOT/usr/share/applications" \
97+ "$DEB_ROOT/usr/share/metainfo"
98+
8499 cp -a "$APP_DIR/." "$DEB_ROOT/opt/ale-psych/"
100+
85101 cat <<'EOF' > "$DEB_ROOT/usr/bin/ale-psych"
86102 #!/usr/bin/env sh
87103 BASE="/opt/ale-psych"
@@ -111,6 +127,21 @@ jobs:
111127 sed -i "s|__VERSION__|$VERSION|g" "$DEB_ROOT/usr/bin/ale-psych"
112128 sed -i "s|__EXE_NAME__|$EXE_NAME|g" "$DEB_ROOT/usr/bin/ale-psych"
113129 chmod 0755 "$DEB_ROOT/usr/bin/ale-psych"
130+
131+ # Zorin/GNOME: match WM_CLASS from `xprop WM_CLASS` => "ALEPsych"
132+ cat <<'EOF' > "$DEB_ROOT/usr/share/applications/ale-psych.desktop"
133+ [Desktop Entry]
134+ Type=Application
135+ Name=ALE Psych
136+ Comment=Friday Night Funkin' ALE Psych
137+ Exec=ale-psych
138+ TryExec=ale-psych
139+ Icon=ale-psych
140+ Terminal=false
141+ Categories=Game;
142+ StartupWMClass=ALEPsych
143+ EOF
144+
114145 cat <<'EOF' > "$DEB_ROOT/usr/share/metainfo/ale-psych.metainfo.xml"
115146 <?xml version="1.0" encoding="UTF-8"?>
116147 <component type="desktop-application">
@@ -125,30 +156,40 @@ jobs:
125156 </description>
126157 </component>
127158 EOF
128- cat <<'EOF' > "$DEB_ROOT/usr/share/applications/ale-psych.desktop"
129- [Desktop Entry]
130- Type=Application
131- Name=ALE Psych
132- Exec=ale-psych
133- Icon=ale-psych
134- Terminal=false
135- Categories=Game;
136- EOF
137- for icon in \
138- usr/share/icons/hicolor/16x16/apps/alepsych.png \
139- usr/share/icons/hicolor/24x24/apps/alepsych.png \
140- usr/share/icons/hicolor/32x32/apps/alepsych.png \
141- usr/share/icons/hicolor/48x48/apps/alepsych.png \
142- usr/share/icons/hicolor/64x64/apps/alepsych.png \
143- usr/share/icons/hicolor/128x128/apps/alepsych.png \
144- usr/share/icons/hicolor/256x256/apps/alepsych.png \
145- usr/share/icons/hicolor/512x512/apps/alepsych.png; do
146- if [ -f "$icon" ]; then
147- dest_dir="$DEB_ROOT/$(dirname "$icon")"
148- mkdir -p "$dest_dir"
149- cp "$icon" "$dest_dir/ale-psych.png"
159+
160+ WORKSPACE="${GITHUB_WORKSPACE:-$PWD}"
161+ for size in 16 24 32 48 64 128 256 512; do
162+ dest_dir="$DEB_ROOT/usr/share/icons/hicolor/${size}x${size}/apps"
163+ mkdir -p "$dest_dir"
164+
165+ src1="$WORKSPACE/usr/share/icons/hicolor/${size}x${size}/apps/alepsych.png"
166+ src2="$WORKSPACE/usr/share/icons/hicolor/${size}x${size}/apps/ale-psych.png"
167+
168+ if [ -f "$src2" ]; then
169+ cp "$src2" "$dest_dir/ale-psych.png"
170+ elif [ -f "$src1" ]; then
171+ cp "$src1" "$dest_dir/ale-psych.png"
150172 fi
151173 done
174+
175+ cat <<'EOF' > "$DEB_ROOT/DEBIAN/postinst"
176+ #!/bin/sh
177+ set -e
178+ update-desktop-database -q /usr/share/applications || true
179+ gtk-update-icon-cache -q /usr/share/icons/hicolor || true
180+ exit 0
181+ EOF
182+ chmod 0755 "$DEB_ROOT/DEBIAN/postinst"
183+
184+ cat <<'EOF' > "$DEB_ROOT/DEBIAN/postrm"
185+ #!/bin/sh
186+ set -e
187+ update-desktop-database -q /usr/share/applications || true
188+ gtk-update-icon-cache -q /usr/share/icons/hicolor || true
189+ exit 0
190+ EOF
191+ chmod 0755 "$DEB_ROOT/DEBIAN/postrm"
192+
152193 cat <<EOF > "$DEB_ROOT/DEBIAN/control"
153194 Package: ale-psych
154195 Version: $VERSION
@@ -159,25 +200,26 @@ jobs:
159200 Homepage: https://alepsych.gamer.gd/
160201 Description: Friday Night Funkin' ALE Psych
161202 EOF
203+
162204 dpkg-deb --build --root-owner-group "$DEB_ROOT" "dist/$DEB_NAME"
163205 artifact_path : export/release/linux/bin
164-
206+
165207 - platform : MacOS
166208 os : macos-15
167209 build_cmd : haxelib run lime build macos --app-version="4.0.0-${{ github.run_id}}"
168210 setup_libs : sh ./install-haxelibs.sh
169211 pre_build_commands :
170212 post_build_commands :
171213 artifact_path : export/release/macos/bin
172-
214+
173215 - platform : MacOS x64
174216 os : macos-15-intel
175217 build_cmd : haxelib run lime build macos --app-version="4.0.0-${{ github.run_id}}"
176218 setup_libs : sh ./install-haxelibs.sh
177219 pre_build_commands :
178220 post_build_commands :
179221 artifact_path : export/release/macos/bin
180-
222+
181223 steps :
182224 - name : Pull the New Commit
183225 uses : actions/checkout@v4.1.7
0 commit comments