Skip to content

Commit

Permalink
Build AppImage
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Oct 5, 2024
1 parent 4417136 commit ee75525
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 30 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build
on: [push, pull_request]

jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: moonlight-installer-windows
path: target/release/moonlight-installer.exe

build-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Build AppImage
run: ./build-linux.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: moonlight-installer-linux
path: ./moonlight-installer-x86_64.AppImage

# TODO: macOS
# build-macos:
30 changes: 0 additions & 30 deletions .github/workflows/tauri.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
/target

# Linux packaging
/AppDir
/appimage-build
*.AppImage
35 changes: 35 additions & 0 deletions AppImageBuilder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 1
AppDir:
path: ./AppDir

app_info:
id: io.github.moonlight-mod.installer
name: moonlight installer
icon: moonlight-installer
version: 0.2.0
exec: usr/bin/moonlight-installer
exec_args: $@

files:
include:
- usr/bin/moonlight-installer

test:
fedora-30:
image: appimagecrafters/tests-env:fedora-30
command: ./AppRun
debian-stable:
image: appimagecrafters/tests-env:debian-stable
command: ./AppRun
archlinux-latest:
image: appimagecrafters/tests-env:archlinux-latest
command: ./AppRun
centos-7:
image: appimagecrafters/tests-env:centos-7
command: ./AppRun
ubuntu-xenial:
image: appimagecrafters/tests-env:ubuntu-xenial
command: ./AppRun

AppImage:
arch: x86_64
29 changes: 29 additions & 0 deletions build-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env sh
set -e

echo "Building installer..."
cargo build --release

if [ -d ./AppDir ]; then
echo "Cleaning up old AppDir..."
rm -rf ./AppDir
fi

echo "Creating AppDir..."
mkdir -p ./AppDir/usr/bin
mkdir -p ./AppDir/usr/share/icons/hicolor/256x256
cp ./target/release/moonlight-installer ./AppDir/usr/bin
cp ./assets/icon.png ./AppDir/usr/share/icons/hicolor/256x256/moonlight-installer.png

if [ ! -f ./appimage-builder-x86_64.AppImage ]; then
echo "Downloading appimage-builder..."
# Nothing has ever gone wrong in the history of downloading random binaries off of the Internet
wget -O ./appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
chmod +x ./appimage-builder-x86_64.AppImage
fi

echo "Building AppImage..."
./appimage-builder-x86_64.AppImage --recipe ./AppImageBuilder.yml

# Move the appimage into a predictable location for CI
mv "./moonlight installer-*-x86_64.AppImage" ./moonlight-installer-x86_64.AppImage

0 comments on commit ee75525

Please sign in to comment.