Skip to content

Commit

Permalink
Github action to build the app-image
Browse files Browse the repository at this point in the history
- Ran into some issues with running the appimage directly via github.
- Runs correctly if it's contents are extracted and ran that way instead
- Did some changes to the AppRun that seems to make it find the libraries better
  • Loading branch information
dafrenchyman committed Jan 13, 2025
1 parent 69d8e4d commit ca65a10
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 7 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build-appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Package AppImage

on:
push:
branches:
- main
- master
- appimage
pull_request:
branches:
- main
- master
- appimage

jobs:
build-appimage:
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3

# Set up dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libgl1-mesa-dev libglu1-mesa-dev \
libsdl2-dev libsdl2-net-dev zlib1g-dev
# Build Supermodel
- name: Build Supermodel
run: |
cd ./AppImage
./build_app_image.sh
- name: Delete Existing latest Release
run: |
gh release delete latest -y || true
gh api -X DELETE /repos/${{ github.repository }}/git/refs/tags/latest || true
- name: Check AppImage File
run: ls -lah ./AppImage/

# Create release as the "latest" tag
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: latest
release_name: "Supermodel Release latest"
draft: false
prerelease: false

- name: Upload AppImage
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
# upload_url: ${{ github.event.release.upload_url }}
asset_path: ./AppImage/Supermodel-x86_64.AppImage
asset_name: Supermodel-x86_64.AppImage
asset_content_type: application/octet-stream
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,5 @@ saves/
/AppImage/appimagetool-x86_64.AppImage
/AppImage/Supermodel.AppDir
/AppImage/Supermodel-x86_64.AppImage
/AppImage/squashfs-root/
/AppImage/appimagetool
7 changes: 6 additions & 1 deletion AppImage/AppRun
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash
HERE="$(dirname "$(readlink -f "$0")")"
#HERE="$(dirname "$(readlink -f "$0")")"
SELF=$(readlink -f "$0")
HERE=${SELF%/*}
#export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
echo "Starting Supermodel"
cd "$HERE/usr"
exec "./bin/Supermodel" "$@"
16 changes: 10 additions & 6 deletions AppImage/build_app_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ make -f Makefiles/Makefile.UNIX NET_BOARD=1 APP_IMAGE=1
cd ./AppImage
mkdir -p ./${APP_DIR}

# Download appimagetool (for creating the image)
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -c
chmod +x appimagetool-x86_64.AppImage

# Copy binary into folder
mkdir -p ./${APP_DIR}/usr/bin
cp ../bin/supermodel ./${APP_DIR}/usr/bin/Supermodel
Expand Down Expand Up @@ -54,5 +50,13 @@ cp /lib/x86_64-linux-gnu/libxcb-randr.so.0 ./${APP_DIR}/usr/lib/
cp /lib/x86_64-linux-gnu/libxcb.so.1 ./${APP_DIR}/usr/lib/
cp /lib/x86_64-linux-gnu/libxkbcommon.so.0 ./${APP_DIR}/usr/lib/

# Build the app-image
./appimagetool-x86_64.AppImage Supermodel.AppDir
echo "Building appimage"
# Download appimagetool (for creating the image)
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -c
chmod +x appimagetool-x86_64.AppImage
# ./appimagetool-x86_64.AppImage Supermodel.AppDir

# Extract out the contents
# NOTE: We do it this way so it can work without FUSE and also work via a github action
./appimagetool-x86_64.AppImage --appimage-extract
./squashfs-root/AppRun ./Supermodel.AppDir

0 comments on commit ca65a10

Please sign in to comment.