@@ -92,12 +92,88 @@ jobs:
9292 cd build
9393 cmake --build . --config Release -j$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)
9494
95- - name : Upload artifact
95+ - name : Create AppImage (Linux only)
96+ if : matrix.target == 'linux-x64'
97+ run : |
98+ set -e
99+ mkdir -p AppDir/usr/bin
100+ cp build/tuisic AppDir/usr/bin/
101+
102+ mkdir -p AppDir/usr/share/applications
103+ printf '%s\n' \
104+ '[Desktop Entry]' \
105+ 'Name=Tuisic' \
106+ 'Exec=tuisic' \
107+ 'Icon=tuisic' \
108+ 'Type=Application' \
109+ 'Categories=Utility;' \
110+ 'Terminal=true' \
111+ > AppDir/usr/share/applications/tuisic.desktop
112+
113+ printf '%s\n' \
114+ 'import struct, zlib, os' \
115+ 'C = (63, 185, 80)' \
116+ 'def png(w, h, C):' \
117+ ' def ch(ct, d):' \
118+ ' p = ct + d' \
119+ ' return struct.pack(">I", len(d)) + p + struct.pack(">I", zlib.crc32(p) & 0xffffffff)' \
120+ ' r = b""' \
121+ ' for y in range(h):' \
122+ ' r += b"\x00" + bytes(C) * w' \
123+ ' return b"\x89PNG\r\n\x1a\n" + ch(b"IHDR", struct.pack(">IIBBBBB", w, h, 8, 2, 0, 0, 0)) + ch(b"IDAT", zlib.compress(r)) + ch(b"IEND", b"")' \
124+ 'for s in [48, 64, 128, 256, 512]:' \
125+ ' d = "AppDir/usr/share/icons/hicolor/{0}x{0}/apps".format(s)' \
126+ ' os.makedirs(d, exist_ok=True)' \
127+ ' with open(d + "/tuisic.png", "wb") as f:' \
128+ ' f.write(png(s, s, C))' \
129+ > /tmp/genicons.py
130+ python3 /tmp/genicons.py
131+
132+ cp AppDir/usr/share/icons/hicolor/256x256/apps/tuisic.png AppDir/tuisic.png
133+ cp AppDir/usr/share/icons/hicolor/256x256/apps/tuisic.png AppDir/.DirIcon
134+
135+ # Download and extract linuxdeploy (populates AppDir with libs)
136+ wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
137+ chmod +x linuxdeploy-x86_64.AppImage
138+ ./linuxdeploy-x86_64.AppImage --appimage-extract
139+ mv squashfs-root linuxdeploy-app
140+
141+ ./linuxdeploy-app/AppRun --appdir AppDir \
142+ -d AppDir/usr/share/applications/tuisic.desktop \
143+ -i AppDir/usr/share/icons/hicolor/256x256/apps/tuisic.png
144+
145+ # Create AppRun entrypoint
146+ cat > AppDir/AppRun << 'EOF'
147+ #!/bin/bash
148+ HERE="$(dirname "$(readlink -f "$0")")"
149+ exec "$HERE/usr/bin/tuisic" "$@"
150+ EOF
151+ chmod +x AppDir/AppRun
152+
153+ # Download appimagetool and create the AppImage
154+ wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
155+ chmod +x appimagetool-x86_64.AppImage
156+ ./appimagetool-x86_64.AppImage --appimage-extract
157+ mv squashfs-root appimagetool-app
158+
159+ ARCH=x86_64 VERSION=1.0.0 ./appimagetool-app/AppRun \
160+ AppDir tuisic-linux-x64.AppImage
161+
162+ ls -lh tuisic-linux-x64.AppImage
163+
164+ - name : Upload binary artifact
96165 uses : actions/upload-artifact@v4
97166 with :
98167 name : ${{ matrix.asset_name }}
99168 path : build/${{ matrix.artifact_name }}
100169
170+ - name : Upload AppImage artifact (Linux only)
171+ if : matrix.target == 'linux-x64'
172+ uses : actions/upload-artifact@v4
173+ with :
174+ name : tuisic-linux-x64.AppImage
175+ path : tuisic-linux-x64.AppImage
176+
101177 release :
102178 needs : build
103179 runs-on : ubuntu-latest
@@ -114,14 +190,15 @@ jobs:
114190
115191 - name : Prepare release assets
116192 run : |
117- # Rename artifacts to have unique names with platform identifiers
118193 mkdir -p release-assets
119194 mv artifacts/tuisic-linux-x64/tuisic release-assets/tuisic-linux-x64
120195 mv artifacts/tuisic-macos-x64/tuisic release-assets/tuisic-macos-x64
121196 mv artifacts/tuisic-macos-arm64/tuisic release-assets/tuisic-macos-arm64
122- # Make all binaries executable
197+ # Move AppImage if present
198+ if [ -f artifacts/tuisic-linux-x64.AppImage/tuisic-linux-x64.AppImage ]; then
199+ mv artifacts/tuisic-linux-x64.AppImage/tuisic-linux-x64.AppImage release-assets/tuisic-linux-x64.AppImage
200+ fi
123201 chmod +x release-assets/*
124- # List files for debugging
125202 ls -lh release-assets/
126203
127204 - name : Generate changelog
@@ -154,11 +231,12 @@ jobs:
154231
155232 ## Downloads
156233 Download the appropriate binary for your platform:
157- - **Linux (x64)**: tuisic-linux-x64
234+ - **Linux (x64)**: tuisic-linux-x64 *(dynamic)* or **tuisic-linux-x64.AppImage** *(portable)*
158235 - **macOS (Intel)**: tuisic-macos-x64
159236 - **macOS (Apple Silicon)**: tuisic-macos-arm64
160237 files : |
161238 release-assets/tuisic-linux-x64
239+ release-assets/tuisic-linux-x64.AppImage
162240 release-assets/tuisic-macos-x64
163241 release-assets/tuisic-macos-arm64
164242 draft : false
0 commit comments