diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34d41f83..33ef8c94 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: - platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. args: '' - platform: 'ubuntu-22.04-arm' - args: '--target aarch64-unknown-linux-gnu' + args: '' - platform: 'windows-latest' args: '' @@ -40,6 +40,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: lts/* + cache: 'yarn' - name: install Rust nightly uses: dtolnay/rust-toolchain@nightly @@ -51,7 +52,7 @@ jobs: if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-22.04-arm' # This must match the platform value defined above. run: | sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils binutils fuse # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. @@ -85,10 +86,16 @@ jobs: echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV echo "Certificate imported. Using identity: $CERT_ID" + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: './src-tauri -> target' + - name: install frontend dependencies run: yarn install # change this to npm, pnpm or bun depending on which one you use. - - uses: tauri-apps/tauri-action@v0 + - id: build + uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} @@ -96,9 +103,24 @@ jobs: APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }} NO_STRIP: true with: - tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + tagName: v__VERSION__ # update the below "upload artifacts to GitHub" if this gets updated releaseName: 'Auto-release v__VERSION__' releaseBody: 'See the assets to download this version and install. This release was created automatically.' releaseDraft: false prerelease: true - args: ${{ matrix.args }} \ No newline at end of file + args: ${{ matrix.args }} + + - name: Bundle AppImage + if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-22.04-arm' + run: | + ./build_appimage.sh --nobuild + + - name: Upload binaries to release + if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-22.04-arm' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/appimage/*.AppImage + file_glob: true + release_id: ${{ steps.build.outputs.releaseId }} + overwrite: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index c60be723..172bdf6f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,13 @@ dist-ssr src-tauri/flamegraph.svg src-tauri/perf* +build/appimage/* +!build/appimage/drop-app.d + +build/appimage/drop-app.d/usr/bin/* +!build/appimage/drop-app.d/usr/bin/.gitkeep + +build/appimage/drop-app.d/usr/lib/* +!build/appimage/drop-app.d/usr/lib/.gitkeep /*.AppImage -/squashfs-root \ No newline at end of file +/squashfs-root diff --git a/build/appimage/drop-app.d/.DirIcon b/build/appimage/drop-app.d/.DirIcon new file mode 120000 index 00000000..a2a9a49e --- /dev/null +++ b/build/appimage/drop-app.d/.DirIcon @@ -0,0 +1 @@ +drop-oss-app.png \ No newline at end of file diff --git a/build/appimage/drop-app.d/AppRun b/build/appimage/drop-app.d/AppRun new file mode 100755 index 00000000..32ab284e --- /dev/null +++ b/build/appimage/drop-app.d/AppRun @@ -0,0 +1,8 @@ +#!/bin/sh + +program="drop-app" + +# point to libraries and run +LD_LIBRARY_PATH=$APPDIR/usr/lib:/usr/local/lib:/usr/lib $APPDIR/usr/bin/$program $@ + +# vim:ft=sh diff --git a/build/appimage/drop-app.d/drop-oss-app.desktop b/build/appimage/drop-app.d/drop-oss-app.desktop new file mode 100644 index 00000000..b80379e3 --- /dev/null +++ b/build/appimage/drop-app.d/drop-oss-app.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Drop Desktop App +Comment=The client application for the open-source, self-hosted game distribution platform Drop. +Exec=AppRun +Icon=drop-oss-app +Type=Application +Categories=Game;Network +MimeType=x-scheme-handler/drop diff --git a/build/appimage/drop-app.d/drop-oss-app.png b/build/appimage/drop-app.d/drop-oss-app.png new file mode 100644 index 00000000..195b297f Binary files /dev/null and b/build/appimage/drop-app.d/drop-oss-app.png differ diff --git a/build/appimage/drop-app.d/usr/bin/.gitkeep b/build/appimage/drop-app.d/usr/bin/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/build/appimage/drop-app.d/usr/lib/.gitkeep b/build/appimage/drop-app.d/usr/lib/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/build_appimage.sh b/build_appimage.sh new file mode 100755 index 00000000..8d3e095f --- /dev/null +++ b/build_appimage.sh @@ -0,0 +1,42 @@ +#!/bin/sh +set -e + +# run this from the root of the git repo to make this work + +arch="$(uname -m)" +git_dir="$PWD" +target_dir="$git_dir/src-tauri/target" +appimage_dir="$git_dir/build/appimage" +appdir="$appimage_dir/drop-app.d" + +build() { + # set up the repo + git submodule init + git submodule update --recursive + + # set up yarn and build + yarn + yarn tauri build +} + +rm -f $appdir/usr/bin/* $appdir/usr/lib/* + +if [[ ! "$1" == "--nobuild" ]]; then + build +fi + +# install binaries in the appdir, then the libraries +cp $target_dir/release/drop-app $appdir/usr/bin +for lib_name in $(ldd "$target_dir/release/drop-app" | grep '=>' | awk '{ print $(NF-1) }'); +do + echo $lib_name + sudo install -g 1000 -o 1000 -Dm755 "$(ls -L1 $lib_name)" $appdir/usr/lib +done + +wget -O $appimage_dir/appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-$arch.AppImage + +cd $appimage_dir +chmod u+x appimagetool +./appimagetool $appdir + +ls "$appimage_dir/" \ No newline at end of file diff --git a/package.json b/package.json index e6079742..759413a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "drop-app", "private": true, + "version": "0.3.1-appimage", "type": "module", "scripts": { "build": "node ./build.mjs", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 0933ad26..b0c5469d 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -62,6 +62,20 @@ version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +[[package]] +name = "appindicator3-sys" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1de844677d52b310793e46a737f3f47334ea8c83dcd617901c0d5c544b260f28" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "libc", + "pkg-config", +] + [[package]] name = "arc-swap" version = "1.7.1" @@ -1286,6 +1300,7 @@ dependencies = [ name = "drop-app" version = "0.3.3" dependencies = [ + "appindicator3-sys", "atomic-instant-full", "bitcode", "boxcar", diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 90caf5c7..887595cf 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -19,6 +19,7 @@ use crate::process::commands::open_process_logs; use crate::process::process_handlers::UMU_LAUNCHER_EXECUTABLE; use crate::remote::commands::auth_initiate_code; use crate::{database::db::DatabaseImpls, games::downloads::commands::resume_download}; +use appindicator3_sys::app_indicator_category_get_type; use bitcode::{Decode, Encode}; use client::commands::fetch_state; use client::{ @@ -272,6 +273,8 @@ pub fn run() { println!("{e}"); })); + let _ = unsafe { app_indicator_category_get_type() }; + let mut builder = tauri::Builder::default() .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_os::init()) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index bfd6cecb..2f4063cf 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -27,7 +27,7 @@ }, "bundle": { "active": true, - "targets": ["nsis", "deb", "rpm", "dmg", "appimage"], + "targets": ["nsis", "deb", "rpm", "dmg"], "windows": { "nsis": { "installMode": "both"