Skip to content

Commit

Permalink
feat: add AppImage packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
florianvazelle committed Feb 25, 2024
1 parent ff9d4d9 commit 9072e33
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 38 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/appimage-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: AppImage Build

on:
workflow_dispatch:
# Ensure the build works on main
push:
branches: [main]
# Ensure the build works on each pull request
pull_request:
# Build and publish on release
release:
types: [published]

jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v1

- name: Load dotenv
run: just ci-load-dotenv

- name: Load dotenv
run: just bump-version

- name: Build AppImage
run: |
# Install FUSE (https://github.com/AppImage/AppImageKit/wiki/FUSE)
sudo add-apt-repository universe
sudo apt install libfuse2
# Install pkg2appimage and build the game (https://github.com/AppImageCommunity/pkg2appimage)
wget -c $(wget -q https://api.github.com/repos/AppImageCommunity/pkg2appimage/releases -O - | grep "pkg2appimage-.*-x86_64.AppImage" | grep browser_download_url | head -n 1 | cut -d '"' -f 4)
chmod +x ./pkg2appimage-*.AppImage
./pkg2appimage-*.AppImage public/packaging/appimage/recipe.yml
# Rename the AppImage
mv ./out/Marble-*.AppImage Marble.AppImage
- uses: actions/upload-artifact@v4
with:
name: Marble.AppImage

# Publish, on each release
- name: Publish AppImage
if: ${{ env.GITHUB_EVENT_NAME == 'release' || (env.GITHUB_EVENT_NAME == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/')) }}
run: |
gh release upload ${{ env.game_version }} ./Marble.AppImage
5 changes: 4 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,13 @@ butler *ARGS: check-butler
sed -i "s,config/version=.*$,config/version=\"{{ game_version }}\",g" ./project.godot

echo "Update version in public/packaging"
# Snap
sed -i "s,version:\ '.*'$,version:\ '{{ game_version }}',g" ./public/packaging/snap/snapcraft.yaml
sed -i "s,archive/refs/tags/.*\.tar\.gz$,archive/refs/tags/{{ game_version }}\.tar\.gz,g" ./public/packaging/snap/snapcraft.yaml
sed -i "s,releases/download/.*/Marble-linux-v.*\.zip$,releases/download/{{ game_version }}/Marble-linux-v{{ game_version }}\.zip,g" ./public/packaging/snap/snapcraft.yaml
sed -i "s,Version=.*$,Version={{ game_version }},g" ./public/packaging/org.mechanicalflower.Marble.desktop
# AppImage
sed -i "s,MechanicalFlower/Marble/.*/,MechanicalFlower/Marble/{{ game_version }}/,g" ./public/packaging/appimage/recipe.yml
sed -i "s,releases/download/.*/Marble-linux-v.*\.zip$,releases/download/{{ game_version }}/Marble-linux-v{{ game_version }}\.zip,g" ./public/packaging/appimage/recipe.yml

[private]
pre-export: clean-addons makedirs bump-version install-addons import-resources
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

A marble race minigame, made with [Godot Engine](https://godotengine.org/).

<a href="https://github.com/mechanicalflower/Marble/releases/" target="_blank"><img src="public/publishing/store/github.webp" alt="Download on Github" height="40px" ></a>
<a href="https://mechanical-flower.itch.io/marble" target="_blank"><img src="public/publishing/store/itchio.webp" alt="Download on itch.io" height="40px" ></a>
<a href="https://github.com/mechanicalflower/Marble/releases/" target="_blank"><img src="public/publishing/store/github.webp" alt="Download on Github" height="40px" ></a>
<a href="https://mechanical-flower.itch.io/marble" target="_blank"><img src="public/publishing/store/itchio.webp" alt="Download on itch.io" height="40px" ></a>
<a href="https://snapcraft.io/marble-race"><img alt="Get it from the Snap Store" src="https://snapcraft.io/static/images/badges/en/snap-store-black.svg" height="40px"/></a>
<a href="https://github.com/mechanicalflower/Marble/releases/"><img alt="Download as AppImage" src="https://docs.appimage.org/_images/download-appimage-banner.svg" height="40px"/></a>
<!-- <a href="https://flathub.org/apps/details/org.mechanicalflower.Marble" target="_blank"><img src="https://flathub.org/assets/badges/flathub-badge-en.png" alt="Download on Flathub" height="40px"></a> -->

</div>
Expand Down
16 changes: 0 additions & 16 deletions public/packaging/appimage/AppRun

This file was deleted.

45 changes: 45 additions & 0 deletions public/packaging/appimage/recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
app: Marble

ingredients:
dist: trusty
sources:
- deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe
packages:
- libx11-6
- libxinerama1
- libxcursor1
- libxrandr2
- libfreetype6
- libpng12-0
- libasound2
- libpulse0
- libgl1-mesa-glx
- zlib1g
- libgcc1
- libc6
script:
# Download released builds
- wget -c "https://github.com/MechanicalFlower/Marble/releases/download/1.6.0/Marble-linux-v1.6.0.zip"
- unzip *.zip
# Download the icon and the .desktop file
- wget -c "https://raw.githubusercontent.com/MechanicalFlower/Marble/1.6.0/public/packaging/org.mechanicalflower.Marble.desktop"
- wget -c "https://raw.githubusercontent.com/MechanicalFlower/Marble/1.6.0/assets/icon.png"

script:
# Replace the icon path in the desktop file
- sed -i.bak -e "s,Icon=org.mechanicalflower.Marble$,Icon=/usr/share/icons/hicolor/apps/marble.png,g" ../org.mechanicalflower.Marble.desktop
# Replace the exec command in the desktop file
- sed -i.bak -e "s,Exec=marble-wrapper$,Exec=bin/Marble.x86_64 --main-pack bin/Marble.pck --rendering-driver opengl3,g" ../org.mechanicalflower.Marble.desktop
# Copy the desktop file
- mkdir -p usr/share/applications/
- cp ../org.mechanicalflower.Marble.desktop .
- cp ../org.mechanicalflower.Marble.desktop usr/share/applications/org.mechanicalflower.Marble.desktop
# Copy the icon
- mkdir -p usr/share/icons/hicolor/apps/
- cp ../icon.png usr/share/icons/hicolor/apps/marble.png
# Copy game files
- mkdir -p usr/bin/
- cp ../Marble.x86_64 usr/bin/Marble.x86_64
- cp ../Marble.pck usr/bin/Marble.pck
# Ensure the game is an executable
- chmod +x usr/bin/Marble.x86_64
1 change: 0 additions & 1 deletion public/packaging/org.mechanicalflower.Marble.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

[Desktop Entry]
Version=1.6.0
Type=Application

Name=Marble
Expand Down
18 changes: 0 additions & 18 deletions public/packaging/snap/snap-xvfb-launch.sh

This file was deleted.

0 comments on commit 9072e33

Please sign in to comment.