Skip to content

Commit eb73817

Browse files
committed
ci(github): implement proper AppImage generation for Linux
This commit replaces the simple tar.gz packaging of the application binaries with a proper `.AppImage` build process using `appimagetool`. It configures the necessary AppDir structure, including the `AppRun` entry point, desktop integration, and icon assets. - **ci(github)**: Integrated `appimagetool` into the `build-desktop-platforms` workflow for the Linux "modern" matrix. - **ci(github)**: Implemented `AppDir` creation logic with custom `AppRun` script and `.desktop` file generation. - **ci(github)**: Updated the upload artifact step to provide the `.AppImage` file directly instead of a compressed archive. - **chore**: Disabled artifact compression for the AppImage as the format is already compressed.
1 parent fb501f9 commit eb73817

1 file changed

Lines changed: 53 additions & 15 deletions

File tree

.github/workflows/build-desktop-platforms.yml

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,30 +196,68 @@ jobs:
196196
find composeApp/build/compose/binaries/main -maxdepth 4 -type f 2>/dev/null | head -30 || echo "No files found"
197197
shell: bash
198198

199-
- name: Package AppImage as tar.gz
199+
- name: Build AppImage with appimagetool
200200
if: matrix.label == 'modern'
201201
run: |
202202
set -euo pipefail
203203
204-
# Find the app-image output directory (could be app-image/ or app/)
205-
APPIMAGE_DIR=""
206-
for dir in composeApp/build/compose/binaries/main/app-image composeApp/build/compose/binaries/main/app; do
207-
if [ -d "$dir" ]; then
208-
APPIMAGE_DIR="$dir"
209-
echo "Found AppImage output at: $dir"
204+
# Find the directory containing the app launcher (bin/GitHub-Store)
205+
APP_ROOT=""
206+
for candidate in \
207+
composeApp/build/compose/binaries/main/app-image/GitHub-Store \
208+
composeApp/build/compose/binaries/main/app/GitHub-Store \
209+
composeApp/build/compose/binaries/main/app-image \
210+
composeApp/build/compose/binaries/main/app; do
211+
if [ -f "$candidate/bin/GitHub-Store" ]; then
212+
APP_ROOT="$candidate"
213+
echo "Found app root at: $candidate"
210214
break
211215
fi
212216
done
213217
214-
if [ -z "$APPIMAGE_DIR" ]; then
215-
echo "ERROR: Could not find AppImage output directory"
216-
ls -la composeApp/build/compose/binaries/main/ || true
218+
if [ -z "$APP_ROOT" ]; then
219+
echo "ERROR: Could not find app launcher (bin/GitHub-Store)"
220+
find composeApp/build/compose/binaries/main -type f -name "GitHub-Store" 2>/dev/null || true
217221
exit 1
218222
fi
219223
220-
tar -czf composeApp/build/compose/binaries/main/GitHub-Store-linux-x64.tar.gz -C "$APPIMAGE_DIR" .
221-
echo "Created tar.gz archive:"
222-
ls -lh composeApp/build/compose/binaries/main/GitHub-Store-linux-x64.tar.gz
224+
# Download appimagetool
225+
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
226+
chmod +x appimagetool-x86_64.AppImage
227+
228+
# Create AppDir from Compose output
229+
APPDIR="GitHub-Store.AppDir"
230+
mv "$APP_ROOT" "$APPDIR"
231+
232+
# Create AppRun entry point
233+
cat > "$APPDIR/AppRun" << 'EOF'
234+
#!/bin/bash
235+
SELF=$(readlink -f "$0")
236+
HERE=${SELF%/*}
237+
exec "${HERE}/bin/GitHub-Store" "$@"
238+
EOF
239+
chmod +x "$APPDIR/AppRun"
240+
241+
# Create .desktop file
242+
cat > "$APPDIR/github-store.desktop" << 'EOF'
243+
[Desktop Entry]
244+
Type=Application
245+
Name=GitHub Store
246+
Exec=GitHub-Store
247+
Icon=github-store
248+
Categories=Development;
249+
Comment=Cross-platform app store for GitHub releases
250+
EOF
251+
252+
# Copy icon to AppDir root (required by appimagetool)
253+
cp composeApp/logo/app_icon.png "$APPDIR/github-store.png"
254+
255+
# Build .AppImage
256+
OUTPUT="composeApp/build/compose/binaries/main/GitHub-Store-x86_64.AppImage"
257+
ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 ./appimagetool-x86_64.AppImage "$APPDIR" "$OUTPUT"
258+
259+
echo "Created AppImage:"
260+
ls -lh "$OUTPUT"
223261
shell: bash
224262

225263
- name: Upload Linux installers
@@ -237,7 +275,7 @@ jobs:
237275
uses: actions/upload-artifact@v4
238276
with:
239277
name: linux-appimage
240-
path: composeApp/build/compose/binaries/main/GitHub-Store-linux-x64.tar.gz
278+
path: composeApp/build/compose/binaries/main/GitHub-Store-x86_64.AppImage
241279
if-no-files-found: error
242280
retention-days: 30
243-
compression-level: 6
281+
compression-level: 0

0 commit comments

Comments
 (0)