mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 01:09:56 -05:00
Feat: Bundle Suwayomi JRE for Windows/Linux
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
name: Build Linux
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Version to build (e.g. 0.4.0)"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
frontend:
|
||||
name: Build frontend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
- name: Upload dist
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frontend-dist-linux
|
||||
path: dist/
|
||||
retention-days: 1
|
||||
|
||||
tauri:
|
||||
name: Tauri (Linux x64)
|
||||
needs: frontend
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download frontend dist
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: frontend-dist-linux
|
||||
path: dist/
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
libwebkit2gtk-4.1-dev \
|
||||
libgtk-3-dev \
|
||||
libayatana-appindicator3-dev \
|
||||
librsvg2-dev \
|
||||
patchelf
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Download Suwayomi (Linux x64)
|
||||
run: |
|
||||
curl -fsSL \
|
||||
"https://github.com/Suwayomi/Suwayomi-Server/releases/download/v2.1.1867/Suwayomi-Server-v2.1.1867-linux-x64.tar.gz" \
|
||||
-o suwayomi-linux.tar.gz
|
||||
|
||||
echo "b2344bd73c4e26bede63cdb4b44b1b4168d8a8500b3b2b1a0219519a3ef708fe suwayomi-linux.tar.gz" | sha256sum -c -
|
||||
|
||||
mkdir -p suwayomi-extracted
|
||||
tar -xzf suwayomi-linux.tar.gz -C suwayomi-extracted --strip-components=1
|
||||
|
||||
echo "Extracted bundle contents (top-level):"
|
||||
ls -la suwayomi-extracted/
|
||||
|
||||
- name: Stage Suwayomi bundle
|
||||
run: |
|
||||
mkdir -p src-tauri/binaries
|
||||
|
||||
JAVA=$(find suwayomi-extracted -path "*/jre/bin/java" | head -1)
|
||||
JAR=$(find suwayomi-extracted -name "Suwayomi-Launcher.jar" | head -1)
|
||||
|
||||
if [ -z "$JAVA" ]; then
|
||||
echo "ERROR: jre/bin/java not found. Bundle contents:"
|
||||
find suwayomi-extracted -type f | head -50
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAR" ]; then
|
||||
echo "ERROR: Suwayomi-Launcher.jar not found. Bundle contents:"
|
||||
find suwayomi-extracted -type f | head -50
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found java: $JAVA"
|
||||
echo "Found jar: $JAR"
|
||||
|
||||
# Copy full bundle as resources so jar + jre tree are available
|
||||
# at runtime via resource_dir/suwayomi-bundle/.
|
||||
cp -r suwayomi-extracted src-tauri/binaries/suwayomi-bundle
|
||||
|
||||
- name: Validate staging
|
||||
run: |
|
||||
echo "--- Validating bundle java ---"
|
||||
find src-tauri/binaries/suwayomi-bundle -path "*/jre/bin/java" \
|
||||
| grep -q . \
|
||||
|| (echo "ERROR: jre/bin/java missing" && exit 1)
|
||||
|
||||
echo "--- Validating bundle jar ---"
|
||||
find src-tauri/binaries/suwayomi-bundle -name "Suwayomi-Launcher.jar" \
|
||||
| grep -q . \
|
||||
|| (echo "ERROR: Suwayomi-Launcher.jar missing" && exit 1)
|
||||
|
||||
echo "Staging OK"
|
||||
|
||||
- name: Patch tauri.conf.json for CI
|
||||
run: |
|
||||
# Suppress the frontend rebuild (dist/ already built by frontend job).
|
||||
sed -i 's/"beforeBuildCommand": "pnpm build"/"beforeBuildCommand": ""/' src-tauri/tauri.conf.json
|
||||
|
||||
# Remove externalBin entirely for Linux — we use bundled resources,
|
||||
# no sidecar registration needed.
|
||||
# Inject the suwayomi-bundle resource glob.
|
||||
python3 - << 'PYEOF'
|
||||
import json
|
||||
with open("src-tauri/tauri.conf.json") as f:
|
||||
conf = json.load(f)
|
||||
conf["bundle"]["resources"] = ["binaries/suwayomi-bundle/**"]
|
||||
conf["bundle"]["externalBin"] = []
|
||||
with open("src-tauri/tauri.conf.json", "w") as f:
|
||||
json.dump(conf, f, indent=2)
|
||||
print("tauri.conf.json patched — resources injected, externalBin cleared")
|
||||
PYEOF
|
||||
|
||||
- name: Build Tauri app (Linux x64)
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
args: --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Upload AppImage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: moku-linux-x64-appimage
|
||||
path: src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload .deb
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: moku-linux-x64-deb
|
||||
path: src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb
|
||||
retention-days: 7
|
||||
Reference in New Issue
Block a user