diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4e384ca --- /dev/null +++ b/.github/workflows/build.yml @@ -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: \ No newline at end of file diff --git a/.github/workflows/tauri.yml b/.github/workflows/tauri.yml deleted file mode 100644 index a106e2e..0000000 --- a/.github/workflows/tauri.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build -on: push - -jobs: - build: - strategy: - fail-fast: false - matrix: - platform: [macos-latest, ubuntu-20.04, windows-latest] - - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - name: Build - run: cargo build --release - - - name: Install dependencies (Linux) - if: matrix.platform == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: moonlight-installer-${{ matrix.platform }} - path: target/release/moonlight-installer${{ matrix.platform == 'windows-latest' && '.exe' || '' }} diff --git a/.gitignore b/.gitignore index ea8c4bf..0634877 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ /target + +# Linux packaging +/AppDir +/appimage-build +*.AppImage diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml new file mode 100644 index 0000000..8b75d14 --- /dev/null +++ b/AppImageBuilder.yml @@ -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 diff --git a/build-linux.sh b/build-linux.sh new file mode 100755 index 0000000..3d32022 --- /dev/null +++ b/build-linux.sh @@ -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